Search code examples
postgresqlpostgresql-9.3

Add Column If Not Exists in Postgresql


Is postgresql (9.3.2) can do check the existence of a column before add a new column? I don't want to create a function just for to check the existence.

Just simply like this :

  ALTER TABLE IF NOT EXISTS table_name ADD COLUMN column_name data_type;

Solution

  • So, there is no such query. I should using PLPGSQL.