ALTER TABLE

Description

Changes the definition of an existing table

Click herearrow-up-right to navigate to the Greenplum documentation page for this syntax.

circle-exclamation

Grammar Syntax

circle-info

Greenplum provides the ability to create ALTER TABLE with multiple actions, but Snowflake does not, that's why is translated to individual ALTER TABLES.

ALTER TABLE [IF EXISTS] [ONLY] <name> 
    <action> [, ... ]

ALTER TABLE [IF EXISTS] [ONLY] <name> 
    RENAME [COLUMN] <column_name> TO <new_column_name>

ALTER TABLE [ IF EXISTS ] [ ONLY ] <name> 
    RENAME CONSTRAINT <constraint_name> TO <new_constraint_name>

ALTER TABLE [IF EXISTS] <name> 
    RENAME TO <new_name>

ALTER TABLE [IF EXISTS] <name> 
    SET SCHEMA <new_schema>

ALTER TABLE ALL IN TABLESPACE <name> [ OWNED BY <role_name> [, ... ] ]
    SET TABLESPACE <new_tablespace> [ NOWAIT ]

ALTER TABLE [IF EXISTS] [ONLY] <name> SET
   [ WITH (reorganize=true|false) ]
     DISTRIBUTED BY ({<column_name> [<opclass>]} [, ... ] )
   | DISTRIBUTED RANDOMLY
   | DISTRIBUTED REPLICATED 

ALTER TABLE <name>
   [ ALTER PARTITION { <partition_name> | FOR (RANK(<number>)) 
   | FOR (<value>) } [...] ] <partition_action>

The ALTER TABLE syntax is a grammar that does not fit on just one page, but here is an overview.

Click herearrow-up-right to go to the Greenplum Standard specification for this syntax.

Navigate to the following pages to get more details about the translation spec for ALTER TABLE syntax.

circle-info

If there's an alter action missing, consult the PostgreSQL ALTER TABLE.

Last updated

Was this helpful?