From c85a7cdd256f55b096cc9b3aea39f80425bd2665 Mon Sep 17 00:00:00 2001 From: naisila Date: Tue, 4 Oct 2022 14:19:53 +0300 Subject: [PATCH] Test --- src/backend/distributed/commands/table.c | 5 ++--- .../distributed/deparser/deparse_table_stmts.c | 15 --------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index e2a28fab6..3d0913720 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -962,6 +962,8 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand, } else if (alterTableType == AT_AddColumn) { + deparseAT = true; + /* * TODO: This code path is nothing beneficial since we do not * support ALTER TABLE %s ADD COLUMN %s [constraint] for foreign keys. @@ -1010,7 +1012,6 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand, if (contain_nextval_expression_walker(expr, NULL)) { - deparseAT = true; useInitialDDLCommandString = false; /* the new column definition will have no constraint */ @@ -1041,8 +1042,6 @@ PreprocessAlterTableStmt(Node *node, const char *alterTableCommand, strcmp(typeName, "bigserial") == 0 || strcmp(typeName, "serial8") == 0) { - deparseAT = true; - ColumnDef *newColDef = copyObject(columnDefinition); newColDef->is_not_null = false; diff --git a/src/backend/distributed/deparser/deparse_table_stmts.c b/src/backend/distributed/deparser/deparse_table_stmts.c index 0232621e4..3222bc181 100644 --- a/src/backend/distributed/deparser/deparse_table_stmts.c +++ b/src/backend/distributed/deparser/deparse_table_stmts.c @@ -141,15 +141,6 @@ AppendAlterTableCmdAddColumn(StringInfo buf, AlterTableCmd *alterTableCmd) ColumnDef *columnDefinition = (ColumnDef *) alterTableCmd->def; - /* - * the way we use the deparser now, constraints are always NULL - * adding this check for ColumnDef consistency - */ - if (columnDefinition->constraints != NULL) - { - ereport(ERROR, (errmsg("Constraints are not supported for AT_AddColumn"))); - } - if (columnDefinition->colname) { appendStringInfo(buf, "%s ", quote_identifier(columnDefinition->colname)); @@ -166,12 +157,6 @@ AppendAlterTableCmdAddColumn(StringInfo buf, AlterTableCmd *alterTableCmd) appendStringInfoString(buf, " NOT NULL"); } - /* - * the way we use the deparser now, collation is never used - * since the data type of columns that use sequences for default - * are only int,smallint and bigint (never text, varchar, char) - * Adding this part only for ColumnDef consistency - */ Oid collationOid = GetColumnDefCollation(NULL, columnDefinition, typeOid); if (OidIsValid(collationOid)) {