MDEV-20913 sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type

Adding the missing grammar.
This commit is contained in:
Alexander Barkov 2019-10-29 13:33:38 +04:00
parent f1e9a0acc8
commit b62a846642
5 changed files with 81 additions and 9 deletions

View file

@ -2148,11 +2148,7 @@ BEGIN
RETURN 0;
END;
$$
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 't1.a%TYPE
AS
BEGIN
RETURN 0;
END' at line 1
ERROR HY000: Unknown data type: 't1'
#
# End of MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations
#

View file

@ -1963,7 +1963,7 @@ DROP TABLE t1;
--echo # %TYPE in function RETURN clause is not supported yet
--echo #
DELIMITER $$;
--error ER_PARSE_ERROR
--error ER_UNKNOWN_DATA_TYPE
CREATE FUNCTION f1 RETURN t1.a%TYPE
AS
BEGIN

View file

@ -0,0 +1,29 @@
#
# Start of 10.5 tests
#
#
# MDEV-20913 sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type
#
SET sql_mode=ORACLE;
CREATE OR REPLACE FUNCTION f1() RETURN INET6 AS
BEGIN
RETURN 'ffff::ffff';
END;
$$
SELECT f1();
f1()
ffff::ffff
DROP FUNCTION f1;
SET sql_mode=ORACLE;
CREATE OR REPLACE FUNCTION f1(a INET6) RETURN INT AS
BEGIN
RETURN LENGTH(a);
END;
$$
SELECT f1('0::0');
f1('0::0')
2
DROP FUNCTION f1;
#
# End of 10.5 tests
#

View file

@ -0,0 +1,35 @@
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-20913 sql_mode=ORACLE: INET6 does not work as a routine parameter type and return type
--echo #
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE OR REPLACE FUNCTION f1() RETURN INET6 AS
BEGIN
RETURN 'ffff::ffff';
END;
$$
DELIMITER ;$$
SELECT f1();
DROP FUNCTION f1;
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE OR REPLACE FUNCTION f1(a INET6) RETURN INT AS
BEGIN
RETURN LENGTH(a);
END;
$$
DELIMITER ;$$
SELECT f1('0::0');
DROP FUNCTION f1;
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -6881,6 +6881,21 @@ sp_param_field_type:
| sp_param_field_type_string
| field_type_lob
| field_type_misc
| IDENT_sys float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| reserved_keyword_udt float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
;
@ -16711,13 +16726,11 @@ reserved_keyword_udt:
| INDEX_SYM
| INFILE
| INNER_SYM
| INOUT_SYM
| INSENSITIVE_SYM
| INSERT
| INTERSECT_SYM
| INTERVAL_SYM
| INTO
| IN_SYM
| IS
| ITERATE_SYM
| JOIN_SYM
@ -16762,7 +16775,6 @@ reserved_keyword_udt:
| OTHERS_ORACLE_SYM
| OUTER
| OUTFILE
| OUT_SYM
| OVER_SYM
| PACKAGE_ORACLE_SYM
| PAGE_CHECKSUM_SYM