17.2. Renaming a Column #

Execute the following query:

  SELECT metastore.rename_column('schema_name.table_name' or 'table_name', 'current_column_name', 'new_column_name');

Where:

  • schema_name: The name of the analytical schema where the table is created.

    Optional parameter. If you do not specify it, the current schema is used.

  • table_name: The name of the analytical table where the column is created.

  • current_column_name: The current column name.

  • new_column_name: The new unique column name.

Example 17.2. 

  SELECT metastore.rename_column('testtable', 'first_col', 'eleventh_col');

Once the query is executed, pgpro_metastore performs the following actions:

  • Verifies user privileges.

  • Updates the column_name value for the column in the pga_column metadata table.

  • Updates the view_sql value for the analytical table.