@@ -259,7 +259,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
259259 AlterFdwStmt AlterForeignServerStmt AlterGroupStmt
260260 AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt
261261 AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt
262- AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterForeignTableStmt
262+ AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt
263263 AlterCompositeTypeStmt AlterUserMappingStmt
264264 AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt
265265 AlterDefaultPrivilegesStmt DefACLAction
@@ -850,7 +850,6 @@ stmt :
850850 | AlterExtensionContentsStmt
851851 | AlterFdwStmt
852852 | AlterForeignServerStmt
853- | AlterForeignTableStmt
854853 | AlterFunctionStmt
855854 | AlterGroupStmt
856855 | AlterObjectDependsStmt
@@ -1836,9 +1835,9 @@ DiscardStmt:
18361835
18371836/* ****************************************************************************
18381837 *
1839- * ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW ] variations
1838+ * ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW | FOREIGN TABLE ] variations
18401839 *
1841- * Note: we accept all subcommands for each of the five variants, and sort
1840+ * Note: we accept all subcommands for each of the variants, and sort
18421841 * out what's really legal at execution time.
18431842 *****************************************************************************/
18441843
@@ -2026,6 +2025,24 @@ AlterTableStmt:
20262025 n->nowait = $14 ;
20272026 $$ = (Node *)n;
20282027 }
2028+ | ALTER FOREIGN TABLE relation_expr alter_table_cmds
2029+ {
2030+ AlterTableStmt *n = makeNode(AlterTableStmt);
2031+ n->relation = $4 ;
2032+ n->cmds = $5 ;
2033+ n->relkind = OBJECT_FOREIGN_TABLE;
2034+ n->missing_ok = false ;
2035+ $$ = (Node *)n;
2036+ }
2037+ | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
2038+ {
2039+ AlterTableStmt *n = makeNode(AlterTableStmt);
2040+ n->relation = $6 ;
2041+ n->cmds = $7 ;
2042+ n->relkind = OBJECT_FOREIGN_TABLE;
2043+ n->missing_ok = true ;
2044+ $$ = (Node *)n;
2045+ }
20292046 ;
20302047
20312048alter_table_cmds :
@@ -5111,34 +5128,6 @@ CreateForeignTableStmt:
51115128 }
51125129 ;
51135130
5114- /* ****************************************************************************
5115- *
5116- * QUERY:
5117- * ALTER FOREIGN TABLE relname [...]
5118- *
5119- *****************************************************************************/
5120-
5121- AlterForeignTableStmt :
5122- ALTER FOREIGN TABLE relation_expr alter_table_cmds
5123- {
5124- AlterTableStmt *n = makeNode(AlterTableStmt);
5125- n->relation = $4 ;
5126- n->cmds = $5 ;
5127- n->relkind = OBJECT_FOREIGN_TABLE;
5128- n->missing_ok = false ;
5129- $$ = (Node *)n;
5130- }
5131- | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds
5132- {
5133- AlterTableStmt *n = makeNode(AlterTableStmt);
5134- n->relation = $6 ;
5135- n->cmds = $7 ;
5136- n->relkind = OBJECT_FOREIGN_TABLE;
5137- n->missing_ok = true ;
5138- $$ = (Node *)n;
5139- }
5140- ;
5141-
51425131/* ****************************************************************************
51435132 *
51445133 * QUERY:
0 commit comments