Pages

Tuesday, April 28, 2015

alter column name in postgres

alter column name in postgres

Say I want to rename a column name of a table in postgres .

The following query can do.



ALTER TABLE <TABLE_NAME> rename COLUMN <OLD_COLUMN_NAME> to <NEW_COLUMN_NAME>;

Ex:

ALTER TABLE infra_cpu_metrics rename COLUMN int_syid to int_sysid;

Reference:
http://www.postgresql.org/docs/8.0/static/sql-altertable.html

No comments:

Post a Comment