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 a90d0cce212 Fix errors for constraints
a90d0cce212 is described below

commit a90d0cce21254df66abb7fdc75845760ddca334a
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Nov 8 23:30:58 2025 +0800

    Fix errors for constraints
---
 src/backend/nodes/copyfuncs.c             |  1 +
 src/backend/nodes/equalfuncs.c            |  1 +
 src/backend/nodes/outfuncs.c              |  1 +
 src/backend/nodes/readfuncs_common.c      |  1 +
 src/test/regress/expected/constraints.out | 15 +++++++--------
 src/test/regress/serial_schedule          |  6 +++---
 src/test/regress/sql/constraints.sql      |  7 -------
 7 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 51b07da90e1..8305a840b6d 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -3731,6 +3731,7 @@ _copyConstraint(const Constraint *from)
        COPY_NODE_FIELD(raw_expr);
        COPY_STRING_FIELD(cooked_expr);
        COPY_SCALAR_FIELD(generated_when);
+       COPY_SCALAR_FIELD(nulls_not_distinct);
        COPY_NODE_FIELD(keys);
        COPY_NODE_FIELD(including);
        COPY_NODE_FIELD(exclusions);
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index dbf23707d7f..77d7ae92ef0 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -3101,6 +3101,7 @@ _equalConstraint(const Constraint *a, const Constraint *b)
        COMPARE_NODE_FIELD(raw_expr);
        COMPARE_STRING_FIELD(cooked_expr);
        COMPARE_SCALAR_FIELD(generated_when);
+       COMPARE_SCALAR_FIELD(nulls_not_distinct);
        COMPARE_NODE_FIELD(keys);
        COMPARE_NODE_FIELD(including);
        COMPARE_NODE_FIELD(exclusions);
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 02f6ffad40b..773bdae1787 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -4133,6 +4133,7 @@ _outConstraint(StringInfo str, const Constraint *node)
        WRITE_NODE_FIELD(raw_expr);
        WRITE_STRING_FIELD(cooked_expr);
        WRITE_CHAR_FIELD(generated_when);
+       WRITE_BOOL_FIELD(nulls_not_distinct);
 
        WRITE_NODE_FIELD(keys);
        WRITE_NODE_FIELD(including);
diff --git a/src/backend/nodes/readfuncs_common.c 
b/src/backend/nodes/readfuncs_common.c
index 3ef9096c9ff..c3eb8a30411 100644
--- a/src/backend/nodes/readfuncs_common.c
+++ b/src/backend/nodes/readfuncs_common.c
@@ -631,6 +631,7 @@ _readConstraint(void)
        READ_NODE_FIELD(raw_expr);
        READ_STRING_FIELD(cooked_expr);
        READ_CHAR_FIELD(generated_when);
+       READ_BOOL_FIELD(nulls_not_distinct);
 
        READ_NODE_FIELD(keys);
        READ_NODE_FIELD(including);
diff --git a/src/test/regress/expected/constraints.out 
b/src/test/regress/expected/constraints.out
index ea990cf22ec..aedb78822fb 100644
--- a/src/test/regress/expected/constraints.out
+++ b/src/test/regress/expected/constraints.out
@@ -7,15 +7,8 @@
 --  - UNIQUE clauses
 --  - EXCLUDE clauses
 --
-<<<<<<< HEAD:src/test/regress/output/constraints.source
--- start_matchsubs
--- m/DETAIL:  Failing row contains \(.*\)/
--- s/DETAIL:  Failing row contains \(.*\)/DETAIL:  Failing row contains 
(#####)/
--- end_matchsubs
-=======
 -- directory paths are passed to us in environment variables
 \getenv abs_srcdir PG_ABS_SRCDIR
->>>>>>> REL_16_9:src/test/regress/expected/constraints.out
 --
 -- DEFAULT syntax
 --
@@ -343,7 +336,7 @@ ERROR:  new row for relation "insert_tbl" violates check 
constraint "insert_tbl_
 DETAIL:  Failing row contains (4, try again, -7).
 INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again';
 ERROR:  new row for relation "insert_tbl" violates check constraint 
"insert_tbl_check"
-DETAIL:  Failing row contains (8, try again, -8).
+DETAIL:  Failing row contains (5, try again, -8).
 -- GPDB: Fixup
 INSERT INTO INSERT_TBL VALUES (7, 'try again', -7);
 SELECT * FROM INSERT_TBL;
@@ -680,10 +673,15 @@ DROP TABLE parted_fk_naming;
 CREATE TEMP TABLE t (a integer, b integer) PARTITION BY HASH (a, b);
 CREATE TEMP TABLE tp (a integer, b integer, PRIMARY KEY (a, b), UNIQUE (b, a));
 ALTER TABLE t ATTACH PARTITION tp FOR VALUES WITH (MODULUS 1, REMAINDER 0);
+ERROR:  distribution policy for "tp" must be the same as that for "t"
 CREATE UNIQUE INDEX t_a_idx ON t (a, b);
 CREATE UNIQUE INDEX t_b_idx ON t (b, a);
 ALTER INDEX t_a_idx ATTACH PARTITION tp_pkey;
+ERROR:  cannot attach index "tp_pkey" as a partition of index "t_a_idx"
+DETAIL:  Index "tp_pkey" is not an index on any partition of table "t".
 ALTER INDEX t_b_idx ATTACH PARTITION tp_b_a_key;
+ERROR:  cannot attach index "tp_b_a_key" as a partition of index "t_b_idx"
+DETAIL:  Index "tp_b_a_key" is not an index on any partition of table "t".
 SELECT conname, conparentid, conislocal, coninhcount
   FROM pg_constraint WHERE conname IN ('tp_pkey', 'tp_b_a_key')
   ORDER BY conname DESC;
@@ -694,6 +692,7 @@ SELECT conname, conparentid, conislocal, coninhcount
 (2 rows)
 
 ALTER TABLE t DETACH PARTITION tp;
+ERROR:  relation "tp" is not a partition of relation "t"
 DROP TABLE t, tp;
 CREATE TEMP TABLE t (a integer) PARTITION BY LIST (a);
 CREATE TEMP TABLE tp (a integer PRIMARY KEY);
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index 34ccc0b9828..9a23517a7cd 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -70,10 +70,10 @@ test: create_index_spgist
 test: create_view
 test: index_including
 test: index_including_gist
-# test: create_aggregate
+test: create_aggregate
 # test: create_function_3
-# test: create_cast
-# test: constraints
+test: create_cast
+test: constraints
 # test: triggers
 # test: select
 # test: inherit
diff --git a/src/test/regress/sql/constraints.sql 
b/src/test/regress/sql/constraints.sql
index 2fb14b53208..cfd402aa81c 100644
--- a/src/test/regress/sql/constraints.sql
+++ b/src/test/regress/sql/constraints.sql
@@ -8,15 +8,8 @@
 --  - EXCLUDE clauses
 --
 
-<<<<<<< HEAD:src/test/regress/input/constraints.source
--- start_matchsubs
--- m/DETAIL:  Failing row contains \(.*\)/
--- s/DETAIL:  Failing row contains \(.*\)/DETAIL:  Failing row contains 
(#####)/
--- end_matchsubs
-=======
 -- directory paths are passed to us in environment variables
 \getenv abs_srcdir PG_ABS_SRCDIR
->>>>>>> REL_16_9:src/test/regress/sql/constraints.sql
 
 --
 -- DEFAULT syntax


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

Reply via email to