terraware
Database
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
rename_column_if_exists
Parameters
Name
Type
Mode
ptable
text
IN
pcolumn
text
IN
new_name
text
IN
Definition
BEGIN -- Rename the column if it exists. IF column_exists(ptable, pcolumn) THEN EXECUTE FORMAT('ALTER TABLE %I RENAME COLUMN %I TO %I;', ptable, pcolumn, new_name); END IF; END