diff options
author | Igor Babaev <igor@askmonty.org> | 2010-07-13 10:45:23 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2010-07-13 10:45:23 -0700 |
commit | df7548f68e5fe1c81e2c06a1bf2f2f3d9af770cb (patch) | |
tree | 3db8fdc9f017571f782938a6a05804dc3f9dc474 /mysql-test/suite/vcol | |
parent | bc013072ba8bddac9336da9cf15e7c89b1deb7aa (diff) | |
download | mariadb-git-df7548f68e5fe1c81e2c06a1bf2f2f3d9af770cb.tar.gz |
Fixed bug #603654.
If a virtual column was used in the ORDER BY clause of a query
and some of the columns this virtual column was based upon were
not referenced anywhere in the query then the execution of the
query could cause an assertion failure.
It happened because in this case the bitmap of the columns used
for ordering keys was not formed correctly.
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_misc.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/vcol_misc.test | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 896dd6fa654..fe41e7e65f3 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -35,3 +35,13 @@ a int NOT NULL DEFAULT '0', v double AS ((1, a)) VIRTUAL ); ERROR HY000: Expression for computed column cannot return a row +CREATE TABLE t1 ( +a CHAR(255) BINARY NOT NULL DEFAULT 0, +b CHAR(255) BINARY NOT NULL DEFAULT 0, +v CHAR(255) BINARY AS (CONCAT(a,b)) VIRTUAL ); +INSERT INTO t1(a,b) VALUES ('4','7'), ('4','6'); +SELECT 1 AS C FROM t1 ORDER BY v; +C +1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 06a9313edd3..2ed08a69fa2 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -30,6 +30,18 @@ CREATE TABLE t1 ( v double AS ((1, a)) VIRTUAL ); +# +# Bug#603654: Virtual column in ORDER BY, no other references of table columns +# + +CREATE TABLE t1 ( + a CHAR(255) BINARY NOT NULL DEFAULT 0, + b CHAR(255) BINARY NOT NULL DEFAULT 0, + v CHAR(255) BINARY AS (CONCAT(a,b)) VIRTUAL ); +INSERT INTO t1(a,b) VALUES ('4','7'), ('4','6'); +SELECT 1 AS C FROM t1 ORDER BY v; + +DROP TABLE t1; |