Changeset: 2ee5dc3af6c5 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ee5dc3af6c5 Added Files: sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.sql sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.err sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.out Modified Files: monetdb5/optimizer/opt_pushselect.c sql/test/BugTracker-2013/Tests/All Branch: Feb2013 Log Message:
fixed bug 3315, bailout in pushselect down on tinter diffs (167 lines): diff --git a/monetdb5/optimizer/opt_pushselect.c b/monetdb5/optimizer/opt_pushselect.c --- a/monetdb5/optimizer/opt_pushselect.c +++ b/monetdb5/optimizer/opt_pushselect.c @@ -129,7 +129,8 @@ OPTpushselectImplementation(Client cntxt } if (getModuleId(p) == algebraRef && - (getFunctionId(p) == tintersectRef || getFunctionId(p) == tdifferenceRef)) + (getFunctionId(p) == tintersectRef || getFunctionId(p) == tinterRef || + getFunctionId(p) == tdifferenceRef || getFunctionId(p) == tdiffRef)) return 0; if (getModuleId(p) == algebraRef && getFunctionId(p) == sliceRef) diff --git a/sql/test/BugTracker-2013/Tests/All b/sql/test/BugTracker-2013/Tests/All --- a/sql/test/BugTracker-2013/Tests/All +++ b/sql/test/BugTracker-2013/Tests/All @@ -31,3 +31,4 @@ avg_needs_abort_on_error.Bug-3329 unique_constraint_on_declared_table.Bug-3319 update_on_declared_table.Bug-3318 correlated_subselect.Bug-3317 +incorrect_subquery_delete.Bug-3315 diff --git a/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.sql b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.sql @@ -0,0 +1,16 @@ +create table x (a integer); +create table y (b integer); +insert into x values (1), (2), (3), (4); +insert into y values (1), (2), (3), (4); +select * from x; +select * from y; +select a from y; +delete from x where a in (select nonexistant from y); +delete from x where a in (select a from y); +select * from x; +insert into x values (1), (2), (3), (4); +delete from x where a in (select a from y where a < 10); +select * from x; + +drop table x; +drop table y; diff --git a/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.err b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.err @@ -0,0 +1,41 @@ +stderr of test 'incorrect_subquery_delete.Bug-3315` in directory 'sql/test/BugTracker-2013` itself: + + +# 13:36:56 > +# 13:36:56 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=32368" "--set" "mapi_usock=/var/tmp/mtest-312/.s.monetdb.32368" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 13:36:56 > + +# builtin opt gdk_dbpath = /home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = yes +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 32368 +# cmdline opt mapi_usock = /var/tmp/mtest-312/.s.monetdb.32368 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbpath = /home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013 +# cmdline opt mal_listing = 0 + +# 13:36:56 > +# 13:36:56 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-312" "--port=32368" +# 13:36:56 > + +MAPI = (monetdb) /var/tmp/mtest-312/.s.monetdb.32368 +QUERY = select a from y; +ERROR = !SELECT: identifier 'a' unknown +MAPI = (monetdb) /var/tmp/mtest-312/.s.monetdb.32368 +QUERY = delete from x where a in (select nonexistant from y); +ERROR = !SELECT: identifier 'nonexistant' unknown + +# 13:36:57 > +# 13:36:57 > "Done." +# 13:36:57 > + diff --git a/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.out b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2013/Tests/incorrect_subquery_delete.Bug-3315.stable.out @@ -0,0 +1,74 @@ +stdout of test 'incorrect_subquery_delete.Bug-3315` in directory 'sql/test/BugTracker-2013` itself: + + +# 13:36:56 > +# 13:36:56 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=32368" "--set" "mapi_usock=/var/tmp/mtest-312/.s.monetdb.32368" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2013" "--set" "mal_listing=0" +# 13:36:56 > + +# MonetDB 5 server v11.15.12 +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2013', using 4 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 3.775 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2013 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://niels.nesco.mine.nu:32368/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-312/.s.monetdb.32368 +# MonetDB/GIS module loaded +# MonetDB/JAQL module loaded +# MonetDB/SQL module loaded + +Ready. + +# 13:36:56 > +# 13:36:56 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-312" "--port=32368" +# 13:36:56 > + +#create table x (a integer); +#create table y (b integer); +#insert into x values (1), (2), (3), (4); +[ 4 ] +#insert into y values (1), (2), (3), (4); +[ 4 ] +#select * from x; +% sys.x # table_name +% a # name +% int # type +% 1 # length +[ 1 ] +[ 2 ] +[ 3 ] +[ 4 ] +#select * from y; +% sys.y # table_name +% b # name +% int # type +% 1 # length +[ 1 ] +[ 2 ] +[ 3 ] +[ 4 ] +#delete from x where a in (select a from y); +[ 4 ] +#select * from x; +% sys.x # table_name +% a # name +% int # type +% 1 # length +#insert into x values (1), (2), (3), (4); +[ 4 ] +#delete from x where a in (select a from y where a < 10); +[ 4 ] +#select * from x; +% sys.x # table_name +% a # name +% int # type +% 1 # length +#drop table x; +#drop table y; + +# 13:36:57 > +# 13:36:57 > "Done." +# 13:36:57 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list