Fold AlterForeignTableStmt into AlterTableStmt

All other relation types are handled by AlterTableStmt, so it's
unnecessary to make a different statement for foreign tables.

Discussion: https://www.postgresql.org/message-id/flat/163c00a5-f634-ca52-fc7c-0e53deda8735%402ndquadrant.com
This commit is contained in:
Peter Eisentraut 2020-06-11 08:21:24 +02:00
parent c2bd1fec32
commit c4325cefba

View File

@ -259,7 +259,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
AlterFdwStmt AlterForeignServerStmt AlterGroupStmt AlterFdwStmt AlterForeignServerStmt AlterGroupStmt
AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt AlterObjectDependsStmt AlterObjectSchemaStmt AlterOwnerStmt
AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt AlterOperatorStmt AlterTypeStmt AlterSeqStmt AlterSystemStmt AlterTableStmt
AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt AlterForeignTableStmt AlterTblSpcStmt AlterExtensionStmt AlterExtensionContentsStmt
AlterCompositeTypeStmt AlterUserMappingStmt AlterCompositeTypeStmt AlterUserMappingStmt
AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt AlterRoleStmt AlterRoleSetStmt AlterPolicyStmt AlterStatsStmt
AlterDefaultPrivilegesStmt DefACLAction AlterDefaultPrivilegesStmt DefACLAction
@ -850,7 +850,6 @@ stmt :
| AlterExtensionContentsStmt | AlterExtensionContentsStmt
| AlterFdwStmt | AlterFdwStmt
| AlterForeignServerStmt | AlterForeignServerStmt
| AlterForeignTableStmt
| AlterFunctionStmt | AlterFunctionStmt
| AlterGroupStmt | AlterGroupStmt
| AlterObjectDependsStmt | AlterObjectDependsStmt
@ -1836,9 +1835,9 @@ DiscardStmt:
/***************************************************************************** /*****************************************************************************
* *
* ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW ] variations * ALTER [ TABLE | INDEX | SEQUENCE | VIEW | MATERIALIZED VIEW | FOREIGN TABLE ] variations
* *
* Note: we accept all subcommands for each of the five variants, and sort * Note: we accept all subcommands for each of the variants, and sort
* out what's really legal at execution time. * out what's really legal at execution time.
*****************************************************************************/ *****************************************************************************/
@ -2026,6 +2025,24 @@ AlterTableStmt:
n->nowait = $14; n->nowait = $14;
$$ = (Node *)n; $$ = (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: alter_table_cmds:
@ -5111,34 +5128,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: * QUERY: