Commit c0576ba5 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))

parent f8a714c8
SET sql_mode=ORACLE;
#
# MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))
#
SELECT CAST(123 AS VARCHAR(10)) FROM DUAL;
CAST(123 AS VARCHAR(10))
123
SELECT CAST(123 AS VARCHAR) FROM DUAL;
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 ') FROM DUAL' at line 1
......@@ -13,3 +13,11 @@ t1 CREATE TABLE "t1" (
"a" varchar(10) DEFAULT NULL
)
DROP TABLE t1;
#
# MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))
#
SELECT CAST(123 AS VARCHAR2(10)) FROM DUAL;
CAST(123 AS VARCHAR2(10))
123
SELECT CAST(123 AS VARCHAR2) FROM DUAL;
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 ') FROM DUAL' at line 1
SET sql_mode=ORACLE;
--echo #
--echo # MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))
--echo #
SELECT CAST(123 AS VARCHAR(10)) FROM DUAL;
--error ER_PARSE_ERROR
SELECT CAST(123 AS VARCHAR) FROM DUAL;
......@@ -8,3 +8,12 @@ DROP TABLE varchar2;
CREATE TABLE t1 (a VARCHAR2(10));
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-11275 sql_mode=ORACLE: CAST(..AS VARCHAR(N))
--echo #
SELECT CAST(123 AS VARCHAR2(10)) FROM DUAL;
--error ER_PARSE_ERROR
SELECT CAST(123 AS VARCHAR2) FROM DUAL;
......@@ -10314,6 +10314,14 @@ cast_type:
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(ITEM_CAST_CHAR, $2); }
| VARCHAR field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(ITEM_CAST_CHAR, $2); }
| VARCHAR2 field_length
{ Lex->charset= thd->variables.collation_connection; }
opt_binary
{ $$.set(ITEM_CAST_CHAR, $2); }
| NCHAR_SYM opt_field_length
{
Lex->charset= national_charset_info;
......
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