Commit 606e2186 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-15630 uuid() function evaluates at wrong time in query

parent bdab8b74
...@@ -572,6 +572,17 @@ N AVG ...@@ -572,6 +572,17 @@ N AVG
0 NULL 0 NULL
drop table t1; 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 # End of 5.5 tests
# #
SELECT NAME_CONST('a', -(1 OR 2)) OR 1; SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
......
...@@ -596,6 +596,18 @@ AND 57813X540X1723 = 'Test'; ...@@ -596,6 +596,18 @@ AND 57813X540X1723 = 'Test';
drop table t1; 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 #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
......
...@@ -997,6 +997,7 @@ class Item_func_uuid: public Item_str_func ...@@ -997,6 +997,7 @@ class Item_func_uuid: public Item_str_func
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII); DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
fix_char_length(MY_UUID_STRING_LENGTH); fix_char_length(MY_UUID_STRING_LENGTH);
} }
table_map used_tables() const { return RAND_TABLE_BIT; }
const char *func_name() const{ return "uuid"; } const char *func_name() const{ return "uuid"; }
String *val_str(String *); String *val_str(String *);
bool check_vcol_func_processor(uchar *int_arg) bool check_vcol_func_processor(uchar *int_arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment