mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-12478 CONCAT function inside view casts values incorrectly with Oracle sql_mode
This commit is contained in:
@ -3,12 +3,12 @@ EXPLAIN EXTENDED SELECT 'a'||'b'||'c';
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select 'a' || 'b' || 'c' AS "'a'||'b'||'c'"
|
||||
Note 1003 select concat_operator_oracle(concat_operator_oracle('a','b'),'c') AS "'a'||'b'||'c'"
|
||||
EXPLAIN EXTENDED SELECT CONCAT('a'||'b'||'c');
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select 'a' || 'b' || 'c' AS "CONCAT('a'||'b'||'c')"
|
||||
Note 1003 select concat_operator_oracle(concat_operator_oracle(concat_operator_oracle('a','b'),'c')) AS "CONCAT('a'||'b'||'c')"
|
||||
SELECT '' || '';
|
||||
'' || ''
|
||||
|
||||
@ -204,3 +204,54 @@ NULL NULL
|
||||
2 ab
|
||||
3 abc
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-12478 CONCAT function inside view casts values incorrectly with Oracle sql_mode
|
||||
#
|
||||
SET sql_mode=ORACLE;
|
||||
CREATE VIEW v1 AS SELECT 'foo'||NULL||'bar' AS test;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS "test" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
foobar
|
||||
SET sql_mode=DEFAULT;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat_operator_oracle(concat_operator_oracle('foo',NULL),'bar') AS `test` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
foobar
|
||||
DROP VIEW v1;
|
||||
SET sql_mode=DEFAULT;
|
||||
CREATE VIEW v1 AS SELECT CONCAT('foo',NULL,'bar') AS test;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select concat('foo',NULL,'bar') AS `test` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
NULL
|
||||
SET sql_mode=ORACLE;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select concat('foo',NULL,'bar') AS "test" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
NULL
|
||||
DROP VIEW v1;
|
||||
SET sql_mode=DEFAULT;
|
||||
CREATE VIEW v1 AS SELECT '0'||'1' AS test;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select '0' or '1' AS `test` latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
1
|
||||
SET sql_mode=ORACLE;
|
||||
SHOW CREATE VIEW v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW "v1" AS select '0' or '1' AS "test" latin1 latin1_swedish_ci
|
||||
SELECT * FROM v1;
|
||||
test
|
||||
1
|
||||
DROP VIEW v1;
|
||||
|
@ -178,9 +178,9 @@ EXECUTE IMMEDIATE 'SELECT :1 FROM DUAL' USING 10;
|
||||
# Testing erroneous and diallowed prepare source
|
||||
#
|
||||
EXECUTE IMMEDIATE _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '||'
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_operator_oracle'
|
||||
PREPARE stmt FROM _latin1'SELECT 1 AS c FROM ' || _latin2 'DUAL';
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation '||'
|
||||
ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'concat_operator_oracle'
|
||||
EXECUTE IMMEDIATE (SELECT 'SELECT 1');
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 'SELECT 1')' at line 1
|
||||
PREPARE stmt FROM (SELECT 'SELECT 1');
|
||||
|
@ -758,7 +758,7 @@ END;
|
||||
END;
|
||||
$$
|
||||
CALL p1();
|
||||
ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation '||'
|
||||
ERROR HY000: Illegal mix of collations (latin1_bin,EXPLICIT) and (latin1_swedish_ci,EXPLICIT) for operation 'concat_operator_oracle'
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# Non-existing field
|
||||
|
Reference in New Issue
Block a user