This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 2508ec36636 Fix alter table add constrant
2508ec36636 is described below

commit 2508ec36636f959a2dae2e87bb3a43b41a1f6774
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Oct 30 23:54:00 2025 +0800

    Fix alter table add constrant
---
 src/backend/commands/tablecmds.c | 11 +++++------
 src/include/nodes/parsenodes.h   |  1 -
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 670c4b85011..08cf9a5c083 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -6573,10 +6573,6 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
                case AT_UnsetTags:
                        ATSetTags(rel, cmd->tags, cmd->unsettag);
                        break;
-               default:                                /* oops */
-                       elog(ERROR, "unrecognized alter table type: %d",
-                                (int) cmd->subtype);
-                       break;
 
                case AT_PartAdd:
                case AT_PartDrop:
@@ -6606,6 +6602,10 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
                                ATExecGPPartCmds(rel, cmd);
                        }
                        break;
+               default:                                /* oops */
+                       elog(ERROR, "unrecognized alter table type: %d",
+                                (int) cmd->subtype);
+                       break;
        }
 
        /*
@@ -6737,7 +6737,7 @@ ATParseTransformCmd(List **wqueue, AlteredTableInfo *tab, 
Relation rel,
                                {
                                        if (Gp_role == GP_ROLE_DISPATCH)
                                                cmd2 = copyObject(cmd2);
-                                       cmd2->subtype = true;
+                                       cmd2->recurse = true;
                                }
                                switch (castNode(Constraint, 
cmd2->def)->contype)
                                {
@@ -7999,7 +7999,6 @@ alter_table_type_to_string(AlterTableType cmdtype)
        {
                case AT_AddColumn:
                case AT_AddColumnToView:
-               case AT_AddColumnRecurse:
                        return "ADD COLUMN";
                case AT_ColumnDefault:
                case AT_CookedColumnDefault:
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index e46fcc2041f..1f944ebd32b 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -2410,7 +2410,6 @@ typedef struct AlterTagStmt
 typedef enum AlterTableType
 {
        AT_AddColumn,                           /* add column */
-       AT_AddColumnRecurse,            /* internal to commands/tablecmds.c */
        AT_AddColumnToView,                     /* implicitly via CREATE OR 
REPLACE VIEW */
        AT_ColumnDefault,                       /* alter column default */
        AT_CookedColumnDefault,         /* add a pre-cooked column default */


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to