Changeset: 856c06c79cc1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/856c06c79cc1
Modified Files:
        clients/mapiclient/dump.c
        sql/test/testdb/Tests/dump-nogeom.stable.out
        sql/test/testdb/Tests/dump.stable.out
        sql/test/testdb/Tests/load.test
Branch: Dec2025
Log Message:

Fix and test for bug #7773.
A check constraint touching multiple columns was returned multiple times
in the internal query, but only the row corresponding with the first
column was used to dump the constraint.  The subsequent rows caused a
comma to be dumped that had no business being dumped.


diffs (61 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1141,7 +1141,7 @@ dump_column_definition(Mapi mid, stream 
                                mnstr_printf(sqlf, " (");
                                cnt = 1;
                        }
-               } else
+               } else if (strcmp(k_type, "4") != 0)
                        mnstr_printf(sqlf, ", ");
                if (cnt)
                        dquoted_print(sqlf, c_column, NULL);
diff --git a/sql/test/testdb/Tests/dump-nogeom.stable.out 
b/sql/test/testdb/Tests/dump-nogeom.stable.out
--- a/sql/test/testdb/Tests/dump-nogeom.stable.out
+++ b/sql/test/testdb/Tests/dump-nogeom.stable.out
@@ -101203,6 +101203,12 @@ CREATE TABLE "testschema"."nulls_not_dis
 );
 COPY 1 RECORDS INTO "testschema"."nulls_not_distinct" FROM stdin USING 
DELIMITERS E'\t',E'\n','"';
 1      1       1       1
+CREATE TABLE "testschema"."double_check" (
+       "c1" INTEGER       NOT NULL,
+       "c2" INTEGER,
+       CONSTRAINT "double_check_c1_check" CHECK (c1 >= 1),
+       CONSTRAINT "c2gtc1" CHECK (c2 is null or c2 > c1)
+);
 CREATE TABLE "testschema"."selfref" (
        "id"       INTEGER       NOT NULL,
        "parentid" INTEGER,
diff --git a/sql/test/testdb/Tests/dump.stable.out 
b/sql/test/testdb/Tests/dump.stable.out
--- a/sql/test/testdb/Tests/dump.stable.out
+++ b/sql/test/testdb/Tests/dump.stable.out
@@ -101203,6 +101203,12 @@ CREATE TABLE "testschema"."nulls_not_dis
 );
 COPY 1 RECORDS INTO "testschema"."nulls_not_distinct" FROM stdin USING 
DELIMITERS E'\t',E'\n','"';
 1      1       1       1
+CREATE TABLE "testschema"."double_check" (
+       "c1" INTEGER       NOT NULL,
+       "c2" INTEGER,
+       CONSTRAINT "double_check_c1_check" CHECK (c1 >= 1),
+       CONSTRAINT "c2gtc1" CHECK (c2 is null or c2 > c1)
+);
 CREATE TABLE "testschema"."selfref" (
        "id"       INTEGER       NOT NULL,
        "parentid" INTEGER,
diff --git a/sql/test/testdb/Tests/load.test b/sql/test/testdb/Tests/load.test
--- a/sql/test/testdb/Tests/load.test
+++ b/sql/test/testdb/Tests/load.test
@@ -101312,6 +101312,13 @@ statement ok
 insert into testschema.nulls_not_distinct values (1, 1, 1, 1)
 
 statement ok
+create table testschema.double_check (
+       c1 int NOT NULL CHECK (c1 >= 1),
+       c2 int,
+       CONSTRAINT c2gtc1 CHECK (c2 IS NULL OR c2 > c1)
+)
+
+statement ok
 CREATE TABLE "testschema"."selfref" (
        "id"       INTEGER       NOT NULL       DEFAULT next value for 
"testschema"."selfref_seq",
        "parentid" INTEGER,
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to