From edc0cbd346a6f5ccd3639b3fa3af01c895e2693e Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Tue, 5 Dec 2000 06:12:19 -0700 Subject: [PATCH 1/4] Added a test case for a coredump bug in SELECT DISTINCT. Have not yet fixed the coredump itself --- .bzrignore | 8 ++++++++ mysql-test/r/3.23/sel000100.res | 0 mysql-test/t/3.23/sel000100.test | 30 ++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 mysql-test/r/3.23/sel000100.res create mode 100644 mysql-test/t/3.23/sel000100.test diff --git a/.bzrignore b/.bzrignore index d0f97026511..692355e2022 100644 --- a/.bzrignore +++ b/.bzrignore @@ -392,3 +392,11 @@ Docs/manual.tp Docs/manual.vr Docs/manual_a4.ps Docs/manual_letter.ps +mysql-test/var/lib/test/test1.frm +mysql-test/var/lib/test/test1.MYD +mysql-test/var/lib/test/test1.MYI +mysql-test/var/lib/test/test2.frm +mysql-test/var/lib/test/test2.MYD +mysql-test/var/lib/test/test2.MYI +mysql-test/var/run/mysqld.pid +mysql-test/var/tmp/mysql.sock diff --git a/mysql-test/r/3.23/sel000100.res b/mysql-test/r/3.23/sel000100.res new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mysql-test/t/3.23/sel000100.test b/mysql-test/t/3.23/sel000100.test new file mode 100644 index 00000000000..20d5a3e2e3a --- /dev/null +++ b/mysql-test/t/3.23/sel000100.test @@ -0,0 +1,30 @@ +DROP TABLE IF EXISTS test1; +DROP TABLE IF EXISTS test2; + +CREATE TABLE test1 ( + ID int(11) NOT NULL auto_increment, + NAME varchar(75) DEFAULT '' NOT NULL, + LINK_ID int(11) DEFAULT '0' NOT NULL, + PRIMARY KEY (ID), + KEY NAME (NAME), + KEY LINK_ID (LINK_ID) +); + +INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0); +INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0); +INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0); + +CREATE TABLE test2 ( + ID int(11) NOT NULL auto_increment, + NAME varchar(150) DEFAULT '' NOT NULL, + PRIMARY KEY (ID), + KEY NAME (NAME) +); + +@r/3.23/sel000100.res SELECT DISTINCT + test2.id AS key_link_id, + test2.name AS link +FROM test1 +LEFT JOIN test2 ON test1.link_id=test2.id +GROUP BY test1.id +ORDER BY link; From 402e8e5c780cb4b2f72861b5cf55f5db2cf1997e Mon Sep 17 00:00:00 2001 From: "monty@narttu.mysql.fi" <> Date: Tue, 5 Dec 2000 16:14:52 +0200 Subject: [PATCH 2/4] Fix for core dump in DISTINCT --- Docs/manual.texi | 3 +++ sql/sql_select.cc | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index 829c1becacb..2bc8d3ae5ac 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -39222,6 +39222,9 @@ though, so Version 3.23 is not released as a stable version yet. @appendixsubsec Changes in release 3.23.29 @itemize @bullet @item +Fixed bug when doing a @code{SELECT DISTINCT ... table1 LEFT JOIN +table2..] when table2 was empty. +@item Added @code{--abort-slave-event-count} and @code{--disconnect-slave-event-count} options to @code{mysqld} for debugging and testing of replication diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8856d31645c..31fc3f28099 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5218,8 +5218,10 @@ remove_duplicates(JOIN *join, TABLE *entry,List &fields) List_iterator it(fields); Item *item; while ((item=it++)) - if (item->tmp_table_field()) + { + if (item->tmp_table_field() && ! item->const_item()) field_count++; + } if (!field_count) { // only const items From 4ed276a4fe45cc83846bdb2b4111e33142335a4a Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Tue, 5 Dec 2000 10:03:30 -0700 Subject: [PATCH 3/4] fixed typo in the manual --- Docs/manual.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index bf0b6d3a63e..ad2e9e51df6 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -39229,7 +39229,7 @@ though, so Version 3.23 is not released as a stable version yet. @itemize @bullet @item Fixed bug when doing a @code{SELECT DISTINCT ... table1 LEFT JOIN -table2..] when table2 was empty. +table2..} when table2 was empty. @item Added @code{--abort-slave-event-count} and @code{--disconnect-slave-event-count} options to @code{mysqld} for From 78b5f8fe8a93d643345dd340eecd3dc10e15208a Mon Sep 17 00:00:00 2001 From: "sasha@mysql.sashanet.com" <> Date: Tue, 5 Dec 2000 10:15:27 -0700 Subject: [PATCH 4/4] updated test case for SELECT DISTINCT coredump --- .bzrignore | 1 + mysql-test/r/3.23/sel000100.res | 0 mysql-test/r/3.23/sel000100.result | 2 ++ mysql-test/t/3.23/sel000100.test | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) delete mode 100644 mysql-test/r/3.23/sel000100.res create mode 100644 mysql-test/r/3.23/sel000100.result diff --git a/.bzrignore b/.bzrignore index 692355e2022..682518d38ce 100644 --- a/.bzrignore +++ b/.bzrignore @@ -400,3 +400,4 @@ mysql-test/var/lib/test/test2.MYD mysql-test/var/lib/test/test2.MYI mysql-test/var/run/mysqld.pid mysql-test/var/tmp/mysql.sock +mysql-test/var/lib/mysql-bin.008 diff --git a/mysql-test/r/3.23/sel000100.res b/mysql-test/r/3.23/sel000100.res deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mysql-test/r/3.23/sel000100.result b/mysql-test/r/3.23/sel000100.result new file mode 100644 index 00000000000..6c204279c28 --- /dev/null +++ b/mysql-test/r/3.23/sel000100.result @@ -0,0 +1,2 @@ +key_link_id link +NULL NULL diff --git a/mysql-test/t/3.23/sel000100.test b/mysql-test/t/3.23/sel000100.test index 20d5a3e2e3a..cd3f7005445 100644 --- a/mysql-test/t/3.23/sel000100.test +++ b/mysql-test/t/3.23/sel000100.test @@ -21,7 +21,7 @@ CREATE TABLE test2 ( KEY NAME (NAME) ); -@r/3.23/sel000100.res SELECT DISTINCT +@r/3.23/sel000100.result SELECT DISTINCT test2.id AS key_link_id, test2.name AS link FROM test1