Changeset: 7bdf7c8ebc65 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7bdf7c8ebc65 Modified Files: sql/server/rel_updates.c sql/test/BugTracker-2020/Tests/All sql/test/SQLancer/Tests/sqlancer09.test testing/Mtest.py.in Branch: default Log Message:
Merged with Oct2020 diffs (truncated from 335 to 300 lines): diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -1244,7 +1244,7 @@ merge_into_table(sql_query *query, dlist mvc *sql = query->sql; char *sname = qname_schema(qname), *tname = qname_schema_object(qname); sql_table *t = NULL; - sql_rel *bt, *joined, *join_rel = NULL, *extra_project, *insert = NULL, *upd_del = NULL, *res = NULL; + sql_rel *bt, *joined, *join_rel = NULL, *extra_project, *insert = NULL, *upd_del = NULL, *res = NULL, *no_tid = NULL; int processed = 0; const char *bt_name; @@ -1347,7 +1347,9 @@ merge_into_table(sql_query *query, dlist //project joined values which didn't match on the join and insert them extra_project = rel_project(sql->sa, join_rel, rel_projections(sql, joined, NULL, 1, 0)); - extra_project = rel_setop(sql->sa, rel_dup(joined), extra_project, op_except); + no_tid = rel_project(sql->sa, rel_dup(joined), rel_projections(sql, joined, NULL, 1, 0)); + extra_project = rel_setop(sql->sa, no_tid, extra_project, op_except); + rel_setop_set_exps(sql, extra_project, rel_projections(sql, extra_project, NULL, 1, 0)); if (!(insert = merge_generate_inserts(query, t, extra_project, sts->h->data.lval, sts->h->next->data.sym))) return NULL; diff --git a/sql/test/BugTracker-2020/Tests/All b/sql/test/BugTracker-2020/Tests/All --- a/sql/test/BugTracker-2020/Tests/All +++ b/sql/test/BugTracker-2020/Tests/All @@ -42,4 +42,5 @@ view_with_aggr_column.Bug-7023 delete-transaction-loose-inserts.Bug-7024 revokeRoleUserLoggedIN.Bug-7026 drop-table-with-auto_increment.Bug-7030 +HAVE_PYMONETDB?dbfarm-foreign-chars.Bug-7031 user-update-privs.Bug-7035 diff --git a/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.py b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.py new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.py @@ -0,0 +1,32 @@ +import sys, os, socket, tempfile, pymonetdb + +try: + from MonetDBtesting import process +except ImportError: + import process + +def freeport(): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock.bind(('', 0)) + port = sock.getsockname()[1] + sock.close() + return port + +with tempfile.TemporaryDirectory() as farm_dir: + mypath = os.path.join(farm_dir, '进起都家', 'myserver','mynode') + os.makedirs(mypath) + + prt = freeport() + with process.server(mapiport=prt, dbname='mynode', dbfarm=mypath, + stdin=process.PIPE, stdout=process.PIPE, + stderr=process.PIPE) as prc: + conn = pymonetdb.connect(database='mynode', port=prt, autocommit=True) + cur = conn.cursor() + + cur.execute('SELECT \'进起都家\';') + if cur.fetchall() != [('进起都家',)]: + sys.stderr.write("'进起都家' expected") + + cur.close() + conn.close() + prc.communicate() diff --git a/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.err b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.err @@ -0,0 +1,12 @@ +stderr of test 'dbfarm-foreign-chars.Bug-7031` in directory 'sql/test/BugTracker-2020` itself: + + +# 10:13:05 > +# 10:13:05 > "/usr/bin/python3.9" "dbfarm-foreign-chars.Bug-7031.py" "dbfarm-foreign-chars.Bug-7031" +# 10:13:05 > + + +# 10:13:07 > +# 10:13:07 > "Done." +# 10:13:07 > + diff --git a/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.out b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2020/Tests/dbfarm-foreign-chars.Bug-7031.stable.out @@ -0,0 +1,12 @@ +stdout of test 'dbfarm-foreign-chars.Bug-7031` in directory 'sql/test/BugTracker-2020` itself: + + +# 10:13:05 > +# 10:13:05 > "/usr/bin/python3.9" "dbfarm-foreign-chars.Bug-7031.py" "dbfarm-foreign-chars.Bug-7031" +# 10:13:05 > + + +# 10:13:07 > +# 10:13:07 > "Done." +# 10:13:07 > + diff --git a/sql/test/SQLancer/Tests/sqlancer09.sql b/sql/test/SQLancer/Tests/sqlancer09.sql --- a/sql/test/SQLancer/Tests/sqlancer09.sql +++ b/sql/test/SQLancer/Tests/sqlancer09.sql @@ -19,3 +19,56 @@ CREATE TABLE "t0" ("tc0" TINYINT NOT NUL update t0 set tc2 = 119, tc0 = cast(t0.tc0 as bigint); update t0 set tc2 = 119, tc0 = (least(+ (cast(least(0, t0.tc0) as bigint)), sign(scale_down(100, 1)))) where true; ROLLBACK; + +START TRANSACTION; +CREATE TABLE "sys"."t0" ("c0" TIMESTAMP NOT NULL,"c1" DOUBLE,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0")); +CREATE TABLE "sys"."t1" ("c0" DECIMAL(12,3)); +COPY 8 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +19522599.000 +0.638 +0.071 +12.000 +0.156 +0.902 +-546.000 +0.603 + +CREATE TABLE "sys"."t2" ("c0" TIMESTAMP,"c1" DOUBLE); +COPY 2 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +NULL -869912003 +NULL 0.9641209077369987 + +create view v0(vc0) as (with cte0(c0) as (with cte0(c0,c1) as (values (interval '2' day, ((null)%(0.3)))), +cte1(c0,c1,c2,c3,c4) as (select all least(r'', r'2'), date '1970-01-13', ((r'')ilike(r'OF먉_')), +((-2)+(-3)), cast(true as string(105)) where false) select distinct cast(case 1.1 when 0.2 then +l1cte1.c1 when 0.4 then l1cte1.c1 when 1.03728474E9 then l1cte1.c1 when 0.2 then l1cte1.c1 else l1cte1.c1 end as string) +from t0 as l1t0, t1 as l1t1,cte0 as l1cte0,cte1 as l1cte1 where not (l1cte1.c2)) select distinct least(-1, l0t0.c1) +from t1 as l0t1, t0 as l0t0,cte0 as l0cte0 where least(cast(l0cte0.c0 as boolean), true)); + +merge into t0 using (select * from v0) as v0 on true when not matched then insert (c1, c0) values ((select 1 from t1), timestamp '1970-01-20 08:57:27'); + +merge into t0 using (select * from v0) as v0 on ((r'>\nAH')not like(cast(scale_up(99, 0.1) as string(278)))) +when not matched then insert (c1, c0) values (((((abs(-5))%((select -3 from t1 as l3t1, t2 as l3t2 where true)))) +>>((((values (1), (1)))>>((select distinct 2 from t1 as l3t1 where false))))), ifthenelse(abs(0.3) = +all(values ((select all 0.1 where true)), (case -1 when -3 then 0.1 +when -2 then -5 end), (((1)>>(1)))), case when least(true, false) then greatest(timestamp '1970-01-15 21:14:28', timestamp '1970-01-02 15:11:23') end, +nullif(timestamp '1970-01-20 08:57:27', sql_add(timestamp '1970-01-07 21:19:48', interval '-3' day)))); +ROLLBACK; + +START TRANSACTION; +CREATE TABLE "sys"."t0" ("c0" TIME NOT NULL, "c1" VARCHAR(143), + CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"), CONSTRAINT "t0_c0_unique" UNIQUE ("c0"), CONSTRAINT "t0_c1_unique" UNIQUE ("c1")); +COPY 7 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +21:19:08 "" +13:02:49 NULL +01:02:11 NULL +16:34:25 NULL +12:11:43 NULL +10:35:38 NULL +04:26:50 NULL + +CREATE TABLE "sys"."t1" ("c0" CHAR(375) NOT NULL, CONSTRAINT "t1_c0_pkey" PRIMARY KEY ("c0"), CONSTRAINT "t1_c0_fkey" FOREIGN KEY ("c0") REFERENCES "sys"."t0" ("c1")); +insert into t1 values (''); +insert into t1(c0) values ((select 'a')), ('b'); +insert into t1(c0) values(r']BW扗}FUp'), (cast((values (greatest(r'Aᨐ', r'_'))) as string(616))), (r''); +ROLLBACK; diff --git a/sql/test/SQLancer/Tests/sqlancer09.stable.out b/sql/test/SQLancer/Tests/sqlancer09.stable.out --- a/sql/test/SQLancer/Tests/sqlancer09.stable.out +++ b/sql/test/SQLancer/Tests/sqlancer09.stable.out @@ -30,6 +30,38 @@ stdout of test 'sqlancer09` in directory #update t0 set tc2 = 119, tc0 = (least(+ (cast(least(0, t0.tc0) as bigint)), sign(scale_down(100, 1)))) where true; [ 0 ] #ROLLBACK; +#START TRANSACTION; +#CREATE TABLE "sys"."t0" ("c0" TIMESTAMP NOT NULL,"c1" DOUBLE,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0")); +#CREATE TABLE "sys"."t1" ("c0" DECIMAL(18,3)); +#COPY 8 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +#19522599.000 +#0.638 +#0.071 +#12.000 +#0.156 +#0.902 +#-546.000 +#0.603 +[ 8 ] +#CREATE TABLE "sys"."t2" ("c0" TIMESTAMP,"c1" DOUBLE); +#COPY 2 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +#NULL -869912003 +#NULL 0.9641209077369987 +[ 2 ] +#create view v0(vc0) as (with cte0(c0) as (with cte0(c0,c1) as (values (interval '2' day, ((null)%(0.3)))), +#cte1(c0,c1,c2,c3,c4) as (select all least(r'', r'2'), date '1970-01-13', ((r'')ilike(r'OF먉_')), +#((-2)+(-3)), cast(true as string(105)) where false) select distinct cast(case 1.1 when 0.2 then +#l1cte1.c1 when 0.4 then l1cte1.c1 when 1.03728474E9 then l1cte1.c1 when 0.2 then l1cte1.c1 else l1cte1.c1 end as string) +#from t0 as l1t0, t1 as l1t1,cte0 as l1cte0,cte1 as l1cte1 where not (l1cte1.c2)) select distinct least(-1, l0t0.c1) +#merge into t0 using (select * from v0) as v0 on true when not matched then insert (c1, c0) values ((select 1 from t1), timestamp '1970-01-20 08:57:27'); +[ 0 ] +#merge into t0 using (select * from v0) as v0 on ((r'>\nAH')not like(cast(scale_up(99, 0.1) as string(278)))) +#when not matched then insert (c1, c0) values (((((abs(-5))%((select -3 from t1 as l3t1, t2 as l3t2 where true)))) +#>>((((values (1), (1)))>>((select distinct 2 from t1 as l3t1 where false))))), ifthenelse(abs(0.3) = +#all(values ((select all 0.1 where true)), (case -1 when -3 then 0.1 +#when -2 then -5 end), (((1)>>(1)))), case when least(true, false) then greatest(timestamp '1970-01-15 21:14:28', timestamp '1970-01-02 15:11:23') end, +[ 0 ] +#ROLLBACK; # 14:35:03 > # 14:35:03 > "Done." diff --git a/sql/test/SQLancer/Tests/sqlancer09.test b/sql/test/SQLancer/Tests/sqlancer09.test --- a/sql/test/SQLancer/Tests/sqlancer09.test +++ b/sql/test/SQLancer/Tests/sqlancer09.test @@ -52,4 +52,85 @@ update t0 set tc2 = 119, tc0 = (least(+ statement ok ROLLBACK +statement ok +START TRANSACTION +statement ok +CREATE TABLE "sys"."t0" ("c0" TIMESTAMP NOT NULL,"c1" DOUBLE,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"),CONSTRAINT "t0_c0_unique" UNIQUE ("c0")) + +statement ok +CREATE TABLE "sys"."t1" ("c0" DECIMAL(12,3)) + +statement ok +COPY 8 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"' +<COPY_INTO_DATA> +19522599.000 +0.638 +0.071 +12.000 +0.156 +0.902 +-546.000 +0.603 + +statement ok +CREATE TABLE "sys"."t2" ("c0" TIMESTAMP,"c1" DOUBLE) + +statement ok +COPY 2 RECORDS INTO "sys"."t2" FROM stdin USING DELIMITERS E'\t',E'\n','"' +<COPY_INTO_DATA> +NULL -869912003 +NULL 0.9641209077369987 + +statement ok +create view v0(vc0) as (with cte0(c0) as (with cte0(c0,c1) as (values (interval '2' day, ((null)%(0.3)))), +cte1(c0,c1,c2,c3,c4) as (select all least(r'', r'2'), date '1970-01-13', ((r'')ilike(r'OF먉_')), +((-2)+(-3)), cast(true as string(105)) where false) select distinct cast(case 1.1 when 0.2 then +l1cte1.c1 when 0.4 then l1cte1.c1 when 1.03728474E9 then l1cte1.c1 when 0.2 then l1cte1.c1 else l1cte1.c1 end as string) +from t0 as l1t0, t1 as l1t1,cte0 as l1cte0,cte1 as l1cte1 where not (l1cte1.c2)) select distinct least(-1, l0t0.c1) +from t1 as l0t1, t0 as l0t0,cte0 as l0cte0 where least(cast(l0cte0.c0 as boolean), true)) + +statement ok +merge into t0 using (select * from v0) as v0 on true when not matched then insert (c1, c0) values ((select 1 from t1), timestamp '1970-01-20 08:57:27') + +statement ok +merge into t0 using (select * from v0) as v0 on ((r'>\nAH')not like(cast(scale_up(99, 0.1) as string(278)))) +when not matched then insert (c1, c0) values (((((abs(-5))%((select -3 from t1 as l3t1, t2 as l3t2 where true)))) +>>((((values (1), (1)))>>((select distinct 2 from t1 as l3t1 where false))))), ifthenelse(abs(0.3) = +all(values ((select all 0.1 where true)), (case -1 when -3 then 0.1 +when -2 then -5 end), (((1)>>(1)))), case when least(true, false) then greatest(timestamp '1970-01-15 21:14:28', timestamp '1970-01-02 15:11:23') end, +nullif(timestamp '1970-01-20 08:57:27', sql_add(timestamp '1970-01-07 21:19:48', interval '-3' day)))) + +statement ok +ROLLBACK + +statement ok +START TRANSACTION + +statement ok +CREATE TABLE "sys"."t0" ("c0" TIME NOT NULL, "c1" VARCHAR(143), + CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"), CONSTRAINT "t0_c0_unique" UNIQUE ("c0"), CONSTRAINT "t0_c1_unique" UNIQUE ("c1")) + +statement ok +COPY 7 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"' +<COPY_INTO_DATA> +21:19:08 "" +13:02:49 NULL +01:02:11 NULL +16:34:25 NULL +12:11:43 NULL +10:35:38 NULL +04:26:50 NULL + +statement ok +CREATE TABLE "sys"."t1" ("c0" CHAR(375) NOT NULL, CONSTRAINT "t1_c0_pkey" PRIMARY KEY ("c0"), CONSTRAINT "t1_c0_fkey" FOREIGN KEY ("c0") REFERENCES "sys"."t0" ("c1")) + +statement ok +insert into t1 values ('') + +statement ok +insert into t1(c0) values ((select 'a')), ('b') + +statement ok +insert into t1(c0) values(r']BW扗}FUp'), (cast((values (greatest(r'Aᨐ', r'_'))) as string(616))), (r'') + diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -1346,8 +1346,8 @@ def PerformDir(env, testdir, testlist, B elif env.get('TRANS_INMEM'): cmd.append('--dbextra=:memory:') _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list