summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-04-03 16:28:52 +0400
committerAlexander Barkov <bar@mariadb.com>2018-04-03 16:28:52 +0400
commit606e21867c0f5765f61efd2478c9f12cf33da71e (patch)
tree3e0b869de773388533c33bb2e3a2d449ded8bd24
parentbdab8b74ff24a25ecbc7aa96addc54767a6c7146 (diff)
downloadmariadb-git-606e21867c0f5765f61efd2478c9f12cf33da71e.tar.gz
MDEV-15630 uuid() function evaluates at wrong time in query
-rw-r--r--mysql-test/r/func_misc.result11
-rw-r--r--mysql-test/t/func_misc.test12
-rw-r--r--sql/item_strfunc.h1
3 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 1c106acf333..66e3cfd4ff4 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -572,6 +572,17 @@ N AVG
0 NULL
drop table t1;
#
+# MDEV-15630 uuid() function evaluates at wrong time in query
+#
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
+COUNT(1) uid
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+DROP TABLE t1;
+#
# End of 5.5 tests
#
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index d7eda5ee4e6..c21630c0c7b 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -596,6 +596,18 @@ AND 57813X540X1723 = 'Test';
drop table t1;
+
+--echo #
+--echo # MDEV-15630 uuid() function evaluates at wrong time in query
+--echo #
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+--replace_column 2 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
+DROP TABLE t1;
+
+
--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 00ae60a7fb1..006b1b90081 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -997,6 +997,7 @@ public:
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
fix_char_length(MY_UUID_STRING_LENGTH);
}
+ table_map used_tables() const { return RAND_TABLE_BIT; }
const char *func_name() const{ return "uuid"; }
String *val_str(String *);
bool check_vcol_func_processor(uchar *int_arg)