summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <igor@olga.mysql.com>2007-12-07 23:36:58 -0800
committerunknown <igor@olga.mysql.com>2007-12-07 23:36:58 -0800
commitb1b2e0d053029ef2111b37f6aa624af364186bde (patch)
tree1ba07ebaff7001c989b3db280d4e56a82ab94f08 /mysql-test
parentbfe58b71f26cd791c5f196d843cb00f9752f8349 (diff)
downloadmariadb-git-b1b2e0d053029ef2111b37f6aa624af364186bde.tar.gz
Fixed bug #27545.
Both arguments of the function NAME_CONST must be constant expressions. This constraint is checked in the Item_name_const::fix_fields method. Yet if the argument of the function was not a constant expression no error message was reported. As a result the client hanged waiting for a response. Now the function Item_name_const::fix_fields reports an error message when any of the additional context conditions imposed on the function NAME_CONST is not satisfied. mysql-test/r/func_misc.result: Added a test case for bug #26545. mysql-test/t/func_misc.test: Added a test case for bug #26545.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_misc.result5
-rw-r--r--mysql-test/t/func_misc.test13
2 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index c941790c35b..d04c22c0c9d 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -207,4 +207,9 @@ test
SELECT NAME_CONST('test', 'test');
test
test
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (5), (2);
+SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
+ERROR HY000: The 'NAME_CONST' syntax is reserved for purposes internal to the MySQL server
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 2c34f77b1ff..e8ee76b3a96 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -204,5 +204,18 @@ SELECT NAME_CONST('test', 1.0);
SELECT NAME_CONST('test', -1.0);
SELECT NAME_CONST('test', 'test');
+#
+# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
+# resolved against a column name of a derived table hangs the client
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (5), (2);
+
+--error ER_RESERVED_SYNTAX
+SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests