26.2. Renaming a Column (metastore.rename_column) #
Required privileges: Postgres Pro AXE administrator only. For more information about stored procedures and privileges, refer to Section 22.1.
Execute the following command:
SELECT metastore.rename_column('table_name', 'current_column_name', 'new_column_name');
Where:
table_name: The name of the analytical table that contains the column.It can be specified as a fully qualified name in the
schema_name.table_nameformat, or as just the table name. If you do not specify the analytical schema name, the current schema is used.current_column_name: The current column name.new_column_name: The new unique column name.A column with this name must not exist in the analytical table.
Postgres Pro AXE performs the following actions:
Verifies input parameters and user privileges.
Updates the
column_namevalue for the column in thepga_columnmetadata table.Updates the
view_sqlvalue for the analytical table.
Example 26.2. Executing the metastore.rename_column stored procedure
SELECT metastore.rename_column('testtable', 'first_col', 'eleventh_col');