#At file:///data0/martin/bzr/bug46259/5.1bt/ based on revid:mikael@stripped
3107 Martin Hansson 2009-09-07 [merge]
Bug#46259: Merge
modified:
mysql-test/r/udf.result
mysql-test/t/udf.test
sql/sql_yacc.yy
=== modified file 'mysql-test/r/udf.result'
--- a/mysql-test/r/udf.result 2009-05-15 12:57:51 +0000
+++ b/mysql-test/r/udf.result 2009-09-07 09:57:22 +0000
@@ -392,4 +392,20 @@ a
4
DROP FUNCTION sequence;
DROP TABLE t1,t2;
+#
+# Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
+b
+1
+2
+3
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
+b
+2
+3
+1
+DROP TABLE t1;
End of 5.0 tests.
=== modified file 'mysql-test/t/udf.test'
--- a/mysql-test/t/udf.test 2007-11-27 15:19:51 +0000
+++ b/mysql-test/t/udf.test 2009-09-07 09:57:22 +0000
@@ -436,4 +436,16 @@ SELECT * FROM t2 WHERE a = sequence();
DROP FUNCTION sequence;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug#46259: 5.0.83 -> 5.1.36, query doesn't work
+--echo #
+CREATE TABLE t1 ( a INT );
+
+INSERT INTO t1 VALUES (1), (2), (3);
+
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b` + 1, 1 );
+SELECT IF( a = 1, a, a ) AS `b` FROM t1 ORDER BY field( `b`, 1 );
+
+DROP TABLE t1;
+
--echo End of 5.0 tests.
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2009-08-29 08:52:22 +0000
+++ b/sql/sql_yacc.yy 2009-09-07 09:57:22 +0000
@@ -7921,7 +7921,13 @@ udf_expr:
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
}
- else
+ /*
+ A field has to have its proper name in order for name
+ resolution to work, something we are only guaranteed if we
+ parse it out. If we hijack the input stream with
+ remember_name we may get quoted or escaped names.
+ */
+ else if ($2->type() != Item::FIELD_ITEM)
$2->set_name($1, (uint) ($3 - $1), YYTHD->charset());
$$= $2;
}
Attachment: [text/bzr-bundle] bzr/martin.hansson@sun.com-20090907145247-q8qhcgweg0qt0j7y.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (martin.hansson:3107) Bug#46259 | Martin Hansson | 7 Sep |