Hello Igor, Ok to push. On Mon, Jul 12, 2010 at 07:08:58PM -0700, Igor Babaev wrote:
Please review this patch for the 5.2 tree.
Regards, Igor.
-------- Original Message -------- Subject: [Commits] bzr commit into Mariadb 5.2, with Maria 2.0:maria/5.2 branch (igor:2822) Bug#603654 Date: Mon, 12 Jul 2010 19:05:37 -0700 (PDT) From: Igor Babaev <igor@askmonty.org> Reply-To: maria-developers@lists.launchpad.net To: commits@mariadb.org
#At lp:maria/5.2 based on revid:igor@askmonty.org-20100713012307-rnom77fx57ef900o
2822 Igor Babaev 2010-07-12 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 referred 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. modified: mysql-test/suite/vcol/r/vcol_misc.result mysql-test/suite/vcol/t/vcol_misc.test sql/filesort.cc
=== modified file 'mysql-test/suite/vcol/r/vcol_misc.result' --- a/mysql-test/suite/vcol/r/vcol_misc.result 2010-07-13 01:23:07 +0000 +++ b/mysql-test/suite/vcol/r/vcol_misc.result 2010-07-13 02:05:28 +0000 @@ -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;
=== modified file 'mysql-test/suite/vcol/t/vcol_misc.test' --- a/mysql-test/suite/vcol/t/vcol_misc.test 2010-07-13 01:23:07 +0000 +++ b/mysql-test/suite/vcol/t/vcol_misc.test 2010-07-13 02:05:28 +0000 @@ -30,6 +30,19 @@ 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; +
=== modified file 'sql/filesort.cc' --- a/sql/filesort.cc 2010-06-01 19:52:20 +0000 +++ b/sql/filesort.cc 2010-07-13 02:05:28 +0000 @@ -1009,7 +1009,14 @@ static void register_used_fields(SORTPAR if ((field= sort_field->field)) { if (field->table == table) - bitmap_set_bit(bitmap, field->field_index); + { + if (field->vcol_info) + { + Item *vcol_item= field->vcol_info->expr_item; + vcol_item->walk(&Item::register_field_in_read_map, 1, (uchar *) 0); + } + bitmap_set_bit(bitmap, field->field_index); + } } else { // Item
_______________________________________________ commits mailing list commits@mariadb.org https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
-- BR Sergey -- Sergey Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog