With Postgres 9.6 this can be done using the option if not exists
ALTER TABLE table_name ADD COLUMN IF NOT EXISTS column_name INTEGER;
More Related Contents:
- How to exit from PostgreSQL command line utility: psql
- Generating time series between two dates in PostgreSQL
- I forgot the password I entered during postgres installation
- Generate series of dates – using date type as input
- Test for null in function with varying parameters
- Postgres query optimization (forcing an index scan)
- Dynamically generate columns for crosstab in PostgreSQL
- I forgot the password I entered during PostgreSQL installation
- PostgreSQL ERROR: canceling statement due to conflict with recovery
- Change type of varchar field to integer: “cannot be cast automatically to type integer”
- Postgresql insert trigger to set value
- now() default values are all showing same timestamp
- Convert escaped Unicode character back to actual character in PostgreSQL
- Insert, on duplicate update in PostgreSQL?
- How does the search_path influence identifier resolution and the “current schema”
- How do you find the row count for all your tables in Postgres
- Run batch file with psql command without password
- invalid byte sequence for encoding “UTF8”
- Postgresql: Conditionally unique constraint
- How do you use variables in a simple PostgreSQL script?
- How to switch databases in psql?
- Compute percents from SUM() in the same SELECT sql query
- Postgresql Truncation speed
- Buffers (Circle) in PostGIS
- How to customize the configuration file of the official PostgreSQL Docker image?
- Does a Postgres UNIQUE constraint imply an index?
- postgres autoincrement not updated on explicit id inserts
- Retrieving Comments from a PostgreSQL DB
- PostgreSQL how to concat interval value ‘2 days’
- Displaying image in Ireports using PostgreSql