diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result index 6bcdf520edb..e62ce1df9e5 100644 --- a/mysql-test/suite/compat/oracle/r/sp.result +++ b/mysql-test/suite/compat/oracle/r/sp.result @@ -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 # diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test index 4fae03b7721..1c977e40f34 100644 --- a/mysql-test/suite/compat/oracle/t/sp.test +++ b/mysql-test/suite/compat/oracle/t/sp.test @@ -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 diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.result new file mode 100644 index 00000000000..8b041e45bea --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.result @@ -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 +# diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.test new file mode 100644 index 00000000000..46754bf9fa5 --- /dev/null +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_oracle.test @@ -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 # diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index bf4083063d7..5a54b7c6eb1 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -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