From 9bba89f80b15356f43aa02d8bbd05e84fa6d36df Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 13 Apr 2020 16:16:26 +0200 Subject: [PATCH v1 2/6] Fold AlterForeignTableStmt into AlterTableStmt All other relation types are handled by AlterTableStmt, so it's unnecessary to make a different statement for foreign tables. --- src/backend/parser/gram.y | 49 +++++++++++++++------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 378390af5d..f00526e9c6 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -259,7 +259,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query); AlterFdwStmt AlterForeignServerStmt AlterGroupStmt AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt - AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterForeignTableStmt + AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterCompositeTypeStmt AlterUserMappingStmt AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt AlterDefaultPrivilegesStmt DefACLAction @@ -851,7 +851,6 @@ stmt : | AlterExtensionContentsStmt | AlterFdwStmt | AlterForeignServerStmt - | AlterForeignTableStmt | AlterFunctionStmt | AlterGroupStmt | AlterObjectDependsStmt @@ -2027,6 +2026,24 @@ AlterTableStmt: n->nowait = $14; $$ = (Node *)n; } + | ALTER FOREIGN TABLE relation_expr alter_table_cmds + { + AlterTableStmt *n = makeNode(AlterTableStmt); + n->relation = $4; + n->cmds = $5; + n->relkind = OBJECT_FOREIGN_TABLE; + n->missing_ok = false; + $$ = (Node *)n; + } + | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds + { + AlterTableStmt *n = makeNode(AlterTableStmt); + n->relation = $6; + n->cmds = $7; + n->relkind = OBJECT_FOREIGN_TABLE; + n->missing_ok = true; + $$ = (Node *)n; + } ; alter_table_cmds: @@ -5116,34 +5133,6 @@ CreateForeignTableStmt: } ; -/***************************************************************************** - * - * QUERY: - * ALTER FOREIGN TABLE relname [...] - * - *****************************************************************************/ - -AlterForeignTableStmt: - ALTER FOREIGN TABLE relation_expr alter_table_cmds - { - AlterTableStmt *n = makeNode(AlterTableStmt); - n->relation = $4; - n->cmds = $5; - n->relkind = OBJECT_FOREIGN_TABLE; - n->missing_ok = false; - $$ = (Node *)n; - } - | ALTER FOREIGN TABLE IF_P EXISTS relation_expr alter_table_cmds - { - AlterTableStmt *n = makeNode(AlterTableStmt); - n->relation = $6; - n->cmds = $7; - n->relkind = OBJECT_FOREIGN_TABLE; - n->missing_ok = true; - $$ = (Node *)n; - } - ; - /***************************************************************************** * * QUERY: -- 2.26.2