mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-33460 select '123' 'x'; unexpected result
Queries that select concatenated constant strings now have colname and value that match. For example, SELECT '123' 'x'; will return a result where the column name and value both are '123x'. Review: Daniel Black
This commit is contained in:
committed by
Daniel Black
parent
76a27155b4
commit
58df20974b
@ -64,7 +64,7 @@ SET sql_mode=@mode;
|
|||||||
# Test litteral concat
|
# Test litteral concat
|
||||||
#
|
#
|
||||||
SELECT 'a' 'b';
|
SELECT 'a' 'b';
|
||||||
a
|
ab
|
||||||
ab
|
ab
|
||||||
SELECT 'a' '';
|
SELECT 'a' '';
|
||||||
a
|
a
|
||||||
@ -76,13 +76,13 @@ SELECT '' '';
|
|||||||
NULL
|
NULL
|
||||||
NULL
|
NULL
|
||||||
SELECT '' 'b' 'c';
|
SELECT '' 'b' 'c';
|
||||||
b
|
bc
|
||||||
bc
|
bc
|
||||||
SELECT '' '' 'c';
|
SELECT '' '' 'c';
|
||||||
c
|
c
|
||||||
c
|
c
|
||||||
SELECT 'a' '' 'c';
|
SELECT 'a' '' 'c';
|
||||||
a
|
ac
|
||||||
ac
|
ac
|
||||||
SELECT 'a' '' '';
|
SELECT 'a' '' '';
|
||||||
a
|
a
|
||||||
@ -208,3 +208,22 @@ t1 CREATE TABLE `t1` (
|
|||||||
KEY `a` (`a`,`b`)
|
KEY `a` (`a`,`b`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-33460 select '123' 'x'; unexpected result
|
||||||
|
#
|
||||||
|
SELECT '';
|
||||||
|
NULL
|
||||||
|
NULL
|
||||||
|
SELECT '' 'b' 'c';
|
||||||
|
bc
|
||||||
|
bc
|
||||||
|
SELECT '' '' 'c';
|
||||||
|
c
|
||||||
|
c
|
||||||
|
SELECT 'a' '' 'c';
|
||||||
|
ac
|
||||||
|
ac
|
||||||
|
SELECT 'a' '' '';
|
||||||
|
a
|
||||||
|
a
|
||||||
|
# End of 10.5 test
|
||||||
|
@ -25,3 +25,15 @@ flush tables;
|
|||||||
update t1 set a = 2;
|
update t1 set a = 2;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-33460 select '123' 'x'; unexpected result
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SELECT '';
|
||||||
|
SELECT '' 'b' 'c';
|
||||||
|
SELECT '' '' 'c';
|
||||||
|
SELECT 'a' '' 'c';
|
||||||
|
SELECT 'a' '' '';
|
||||||
|
|
||||||
|
--echo # End of 10.5 test
|
||||||
|
@ -8,7 +8,7 @@ select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
|
|||||||
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
||||||
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
|
||||||
select 'hello' 'monty';
|
select 'hello' 'monty';
|
||||||
hello
|
hellomonty
|
||||||
hellomonty
|
hellomonty
|
||||||
select length('\n\t\r\b\0\_\%\\');
|
select length('\n\t\r\b\0\_\%\\');
|
||||||
length('\n\t\r\b\0\_\%\\')
|
length('\n\t\r\b\0\_\%\\')
|
||||||
|
@ -894,7 +894,7 @@ show status like '%cost%';
|
|||||||
Variable_name Value
|
Variable_name Value
|
||||||
Last_query_cost 4.016090
|
Last_query_cost 4.016090
|
||||||
select 'The cost of accessing t1 (dont care if it changes' '^';
|
select 'The cost of accessing t1 (dont care if it changes' '^';
|
||||||
The cost of accessing t1 (dont care if it changes
|
The cost of accessing t1 (dont care if it changes^
|
||||||
The cost of accessing t1 (dont care if it changes^
|
The cost of accessing t1 (dont care if it changes^
|
||||||
select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;
|
select 'vv: Following query must use ALL(t1), eq_ref(A), eq_ref(B): vv' Z;
|
||||||
Z
|
Z
|
||||||
|
@ -64,7 +64,7 @@ SET sql_mode=@mode;
|
|||||||
# Test litteral concat
|
# Test litteral concat
|
||||||
#
|
#
|
||||||
SELECT 'a' 'b';
|
SELECT 'a' 'b';
|
||||||
a
|
ab
|
||||||
ab
|
ab
|
||||||
SELECT 'a' '';
|
SELECT 'a' '';
|
||||||
a
|
a
|
||||||
@ -76,13 +76,13 @@ SELECT '' '';
|
|||||||
NULL
|
NULL
|
||||||
NULL
|
NULL
|
||||||
SELECT '' 'b' 'c';
|
SELECT '' 'b' 'c';
|
||||||
b
|
bc
|
||||||
bc
|
bc
|
||||||
SELECT '' '' 'c';
|
SELECT '' '' 'c';
|
||||||
c
|
c
|
||||||
c
|
c
|
||||||
SELECT 'a' '' 'c';
|
SELECT 'a' '' 'c';
|
||||||
a
|
ac
|
||||||
ac
|
ac
|
||||||
SELECT 'a' '' '';
|
SELECT 'a' '' '';
|
||||||
a
|
a
|
||||||
|
@ -6943,6 +6943,7 @@ Item_basic_constant *
|
|||||||
Item_string::make_string_literal_concat(THD *thd, const LEX_CSTRING *str)
|
Item_string::make_string_literal_concat(THD *thd, const LEX_CSTRING *str)
|
||||||
{
|
{
|
||||||
append(str->str, (uint32) str->length);
|
append(str->str, (uint32) str->length);
|
||||||
|
set_name(thd, &str_value);
|
||||||
if (!(collation.repertoire & MY_REPERTOIRE_EXTENDED))
|
if (!(collation.repertoire & MY_REPERTOIRE_EXTENDED))
|
||||||
{
|
{
|
||||||
// If the string has been pure ASCII so far, check the new part.
|
// If the string has been pure ASCII so far, check the new part.
|
||||||
|
Reference in New Issue
Block a user