diff options
author | Michael Widenius <monty@askmonty.org> | 2011-06-24 10:08:09 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-06-24 10:08:09 +0300 |
commit | 6a9ac86cd374185918a0398c56d101ac7e1fddf8 (patch) | |
tree | d1cbfdde25f2ce155ebf00ec8c29b22fd7eb8b6e /mysql-test/r/join.result | |
parent | 135ce0ba6c9457c4c968b420a16e5bda69f222e0 (diff) | |
download | mariadb-git-6a9ac86cd374185918a0398c56d101ac7e1fddf8.tar.gz |
Fix for bug lp:798597 Incorrect "Duplicate entry" error with views and GROUP BY
mysql-test/r/join.result:
Test case for LP:798597
mysql-test/t/join.test:
Test case for LP:798597
sql/sql_select.cc:
In simplify_joins we reset table->maybe_null for outer join tables that can't ever be NULL.
This caused a conflict between the previously calculated items and the group_buffer against the fields
in the temporary table that are created as not null thanks to the optimization.
The fix is to correct the group by items to also be not_null so that they match the used fields and keys.
Diffstat (limited to 'mysql-test/r/join.result')
-rw-r--r-- | mysql-test/r/join.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index 96504df4b1e..dae3d16c781 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3; +drop view if exists v1,v2; CREATE TABLE t1 (S1 INT); CREATE TABLE t2 (S1 INT); INSERT INTO t1 VALUES (1); @@ -1220,4 +1221,22 @@ f1 2 DEALLOCATE PREPARE stmt; DROP TABLE t1; +# +# Bug LP:798597: Incorrect "Duplicate entry" error with views and +# GROUP BY +# +CREATE TABLE t1 ( f1 int NOT NULL , f2 int NOT NULL ) ; +INSERT INTO t1 VALUES (214,0),(6,6); +CREATE TABLE t2 ( f2 int) ; +INSERT INTO t2 VALUES (88),(88); +CREATE ALGORITHM=MERGE VIEW v1 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0) ; +CREATE ALGORITHM=MERGE VIEW v2 AS SELECT t1.f1, t2.f2 FROM (t2 LEFT JOIN t1 ON (t2.f2 <> t1.f1)) WHERE (t1.f2 <= 0 or t1.f2 is null) ; +SELECT f1 , MIN(f2) FROM v1 GROUP BY f1; +f1 MIN(f2) +214 88 +SELECT f1 , MIN(f2) FROM v2 GROUP BY f1; +f1 MIN(f2) +214 88 +drop table t1,t2; +drop view v1,v2; End of 5.1 tests |