reshke commented on issue #1566:
URL: https://github.com/apache/cloudberry/issues/1566#issuecomment-3940241025
```
reshke@yezzey-cbdb-bench:~/cloudberry$ git status
On branch address_1566_p4
You are currently cherry-picking commit 731d514ae58.
(fix conflicts and run "git cherry-pick --continue")
(use "git cherry-pick --skip" to skip this patch)
(use "git cherry-pick --abort" to cancel the cherry-pick operation)
Changes to be committed:
modified: src/backend/commands/trigger.c
modified: src/include/commands/trigger.h
modified: src/test/regress/expected/triggers.out
modified: src/test/regress/sql/triggers.sql
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: src/backend/commands/tablecmds.c
both modified: src/backend/nodes/copyfuncs.c
both modified: src/backend/nodes/equalfuncs.c
both modified: src/include/nodes/parsenodes.h
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: src/test/regress/sql/misc.sql
reshke@yezzey-cbdb-bench:~/cloudberry$ git diff src/backend/ src/include/
diff --cc src/backend/commands/tablecmds.c
index 07f00a212b0,103c53c72a6..00000000000
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@@ -511,11 -551,10 +511,12 @@@ static void ATExecSetTableSpace(Oid tab
static void ATExecSetTableSpaceNoStorage(Relation rel, Oid newTableSpace);
static void ATExecSetRelOptions(Relation rel, List *defList,
AlterTableType operation,
+ bool
*aoopt_changed,
+ Oid
newAccessMethod,
LOCKMODE
lockmode);
static void ATExecEnableDisableTrigger(Relation rel, const char *trigname,
-
char fires_when, bool skip_system, LOCKMODE lockmode);
+
char fires_when, bool skip_system, bool recurse,
+
LOCKMODE lockmode);
static void ATExecEnableDisableRule(Relation rel, const char *rulename,
char
fires_when, LOCKMODE lockmode);
static void ATPrepAddInherit(Relation child_rel);
@@@ -5863,9 -4726,10 +5868,16 @@@ ATPrepCmd(List **wqueue, Relation rel,
case AT_DisableTrig: /* DISABLE TRIGGER variants */
case AT_DisableTrigAll:
case AT_DisableTrigUser:
++<<<<<<< HEAD
+ ATSimplePermissions(rel, ATT_TABLE |
ATT_FOREIGN_TABLE | ATT_DIRECTORY_TABLE);
+ if (rel->rd_rel->relkind ==
RELKIND_PARTITIONED_TABLE)
+ ATSimpleRecursion(wqueue, rel, cmd, recurse,
lockmode, context);
++=======
+ ATSimplePermissions(rel, ATT_TABLE |
ATT_FOREIGN_TABLE);
+ /* Set up recursion for phase 2; no other prep
needed */
+ if (recurse)
+ cmd->recurse = true;
++>>>>>>> 731d514ae58 (Fix ENABLE/DISABLE TRIGGER to handle recursion
correctly)
pass = AT_PASS_MISC;
break;
case AT_EnableRule: /* ENABLE/DISABLE RULE
variants */
@@@ -16812,38 -14200,11 +16840,44 @@@ index_copy_data(Relation rel, RelFileNo
*/
static void
ATExecEnableDisableTrigger(Relation rel, const char *trigname,
- char fires_when, bool
skip_system, LOCKMODE lockmode)
+ char fires_when, bool
skip_system, bool recurse,
+ LOCKMODE lockmode)
{
++<<<<<<< HEAD
+ EnableDisableTrigger(rel, trigname, fires_when, skip_system,
lockmode);
+
+ /* MPP-6929: metadata tracking */
+ if (Gp_role == GP_ROLE_DISPATCH &&
MetaTrackValidKindNsp(rel->rd_rel))
+ {
+ char *subtype;
+ switch (fires_when)
+ {
+ case TRIGGER_FIRES_ON_ORIGIN:
+ subtype = "ENABLE TRIGGER";
+ break;
+ case TRIGGER_FIRES_ALWAYS:
+ subtype = "ENABLE ALWAYS TRIGGER";
+ break;
+ case TRIGGER_FIRES_ON_REPLICA:
+ subtype = "ENABLE REPLICA TRIGGER";
+ break;
+ case TRIGGER_DISABLED:
+ subtype = "DISBLE TRIGGER";
+ break;
+ default:
+ subtype = "unknown trigger mode";
+ break;
+ }
+ MetaTrackUpdObject(RelationRelationId,
+ RelationGetRelid(rel),
+ GetUserId(),
+ "ALTER",
+ subtype);
+ }
++=======
+ EnableDisableTriggerNew(rel, trigname, fires_when, skip_system,
recurse,
+ lockmode);
++>>>>>>> 731d514ae58 (Fix ENABLE/DISABLE TRIGGER to handle recursion
correctly)
}
/*
diff --cc src/backend/nodes/copyfuncs.c
index 3a9fd32741d,4d9746d54a0..00000000000
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@@ -4064,8 -3344,7 +4064,12 @@@ _copyAlterTableCmd(const AlterTableCmd
COPY_NODE_FIELD(def);
COPY_SCALAR_FIELD(behavior);
COPY_SCALAR_FIELD(missing_ok);
++<<<<<<< HEAD
+ COPY_NODE_FIELD(tags);
+ COPY_SCALAR_FIELD(unsettag);
++=======
+ COPY_SCALAR_FIELD(recurse);
++>>>>>>> 731d514ae58 (Fix ENABLE/DISABLE TRIGGER to handle recursion
correctly)
return newnode;
}
diff --cc src/backend/nodes/equalfuncs.c
index 9981c2fd023,523a6ce24b8..00000000000
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@@ -1220,8 -1136,7 +1220,12 @@@ _equalAlterTableCmd(const AlterTableCm
COMPARE_NODE_FIELD(def);
COMPARE_SCALAR_FIELD(behavior);
COMPARE_SCALAR_FIELD(missing_ok);
++<<<<<<< HEAD
+ COMPARE_NODE_FIELD(tags);
+ COMPARE_SCALAR_FIELD(unsettag);
++=======
+ COMPARE_SCALAR_FIELD(recurse);
++>>>>>>> 731d514ae58 (Fix ENABLE/DISABLE TRIGGER to handle recursion
correctly)
return true;
}
diff --cc src/include/nodes/parsenodes.h
index 449fb3fba03,c4847ac1a9b..00000000000
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@@ -2178,88 -1954,11 +2178,92 @@@ typedef struct AlterTableCmd /* one sub
RoleSpec *newowner;
Node *def; /* definition of new column,
index,
*
constraint, or parent table */
+ Node *transform; /* transformation expr for ALTER
TYPE */
DropBehavior behavior; /* RESTRICT or CASCADE for DROP
cases */
bool missing_ok; /* skip error if missing? */
++<<<<<<< HEAD
+
+ /*
+ * Extra information dispatched from QD to QEs in
AT_SetDistributedBy and
+ * AT_ExpandTable
+ */
+ int backendId; /* backend ID on QD, if a temporary
table was created */
+
+ /* Used for for GPDB's partition syntax to support
parser_errposition() */
+ const char *queryString;
+
+ GpPolicy *policy;
+
+ List *tags; /* List of tags, DefElem or
String nodes */
+ bool unsettag; /* Whether unset tag */
+
++=======
+ bool recurse; /* exec-time recursion */
++>>>>>>> 731d514ae58 (Fix ENABLE/DISABLE TRIGGER to handle recursion
correctly)
} AlterTableCmd;
+typedef enum GpAlterPartitionIdType
+{
+ AT_AP_IDNone, /* no ID */
+ AT_AP_IDName, /* IDentify by Name */
+ AT_AP_IDValue, /* IDentifier FOR Value */
+ AT_AP_IDDefault, /* IDentify DEFAULT
partition */
+} GpAlterPartitionIdType;
+
+typedef struct GpAlterPartitionId /* Identify a partition by name, val,
pos */
+{
+ NodeTag type;
+ GpAlterPartitionIdType idtype;/* Type of table alteration to apply */
+ Node *partiddef; /* partition id definition */
+ int location; /* token location,
or -1 if unknown */
+} GpAlterPartitionId;
+
+typedef struct GpDropPartitionCmd
+{
+ NodeTag type;
+ Node *partid; /* partition id of the
partition to drop */
+ DropBehavior behavior; /* RESTRICT or CASCADE */
+ bool missing_ok;
+} GpDropPartitionCmd;
+
+typedef struct GpAlterPartitionCmd
+{
+ NodeTag type;
+ GpAlterPartitionId *partid; /* partition
id of the partition to add */
+ Node *arg; /* argument 1 */
+ int location; /* token location, or -1 if unknown */
+} GpAlterPartitionCmd;
+
+/*
+ * In PostgreSQL, the lower boundary is always inclusive and the upper
+ * boundary is exclusive. The legacy syntax was more flexible.
+ */
+typedef enum GpPartitionEdgeBounding
+{
+ PART_EDGE_UNSPECIFIED,
+ PART_EDGE_INCLUSIVE,
+ PART_EDGE_EXCLUSIVE
+} GpPartitionEdgeBounding;
+
+/* the "values" of a START or END spec in a RANGE partition */
+typedef struct GpPartitionRangeItem
+{
+ NodeTag type;
+ List *val; /* value */
+ GpPartitionEdgeBounding edge; /* inclusive/exclusive ? */
+ int location; /*
token location, or -1 if unknown */
+} GpPartitionRangeItem;
+
+typedef struct GpSplitPartitionCmd
+{
+ NodeTag type;
+ GpAlterPartitionId *partid;
+ GpPartitionRangeItem *start;
+ GpPartitionRangeItem *end;
+ List *at;
+ GpAlterPartitionCmd *arg2;
+ int location;
+} GpSplitPartitionCmd;
/* ----------------------
* Alter Collation
(END)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]