Hello Sergei,
Thanks for your review.
On 10/21/23 10:18 PM, Sergei Golubchik wrote:
Hi, Alexander,
On Oct 21, Alexander Barkov wrote:
revision-id: ce9ce585e72 (mariadb-10.4.30-103-gce9ce585e72)
parent(s): 1fde785315e
author: Alexander Barkov
committer: Alexander Barkov
timestamp: 2023-08-31 13:49:19 +0400
message:
MDEV-31184 Remove parser tokens DECODE_MARIADB_SYM and DECODE_ORACLE_SYM
Changing the code handling sql_mode-dependent function DECODE():
- removing parser tokens DECODE_MARIADB_SYM and DECODE_ORACLE_SYM
- removing the DECODE() related code from sql_yacc.yy/sql_yacc_ora.yy
- adding handling of DECODE() with help of a new Create_func_func_decode
please, add a test for DECODE_MARIADB_SYM that changes from
ER_PARSE_ERROR to ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT.
https://github.com/MariaDB/server/commit/0e43e544a8d03163ad0cbc8479d0ae3cf7b191e3
Why sql_yacc.yy had rules for DECODE_ORACLE_SYM and vice versa?
Was it possible to get DECODE_ORACLE_SYM in sql_yacc.yy?
No, it was not.
I was trying to maintain the two *.yy files in the way reduce the
difference between them. Having:
- DECODE_ORACLE_SYM in sql_yacc.yy
- DECODE_MARIADB_SYM in sql_yacc_ora.yy
was useless, but was not harmful.
diff --git a/mysql-test/suite/compat/oracle/r/func_decode.result
b/mysql-test/suite/compat/oracle/r/func_decode.result
index b49bad93627..2809e971be3 100644
--- a/mysql-test/suite/compat/oracle/r/func_decode.result
+++ b/mysql-test/suite/compat/oracle/r/func_decode.result
@@ -1,8 +1,8 @@
SET sql_mode=ORACLE;
SELECT DECODE(10);
-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 ')'
at line 1
+ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
SELECT DECODE(10,10);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index cdc04d93708..048741b6ca1 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -11027,18 +11024,6 @@ function_call_nonkeyword:
if (unlikely($$ == NULL))
MYSQL_YYABORT;
}
- | DECODE_MARIADB_SYM '(' expr ',' expr ')'
- {
- $$= new (thd->mem_root) Item_func_decode(thd, $3, $5);
- if (unlikely($$ == NULL))
- MYSQL_YYABORT;
- }
- | DECODE_ORACLE_SYM '(' expr ',' decode_when_list_oracle ')'
- {
- $5->push_front($3, thd->mem_root);
- if (unlikely(!($$= new (thd->mem_root)
Item_func_decode_oracle(thd, *$5))))
- MYSQL_YYABORT;
- }
| EXTRACT_SYM '(' interval FROM expr ')'
{
$$=new (thd->mem_root) Item_extract(thd, $3, $5);
@@ -12209,25 +12194,6 @@ when_list_opt_else:
}
;
-decode_when_list_oracle:
- expr ',' expr
- {
- $$= new (thd->mem_root) List<Item>;
- if (unlikely($$ == NULL) ||
- unlikely($$->push_back($1, thd->mem_root)) ||
- unlikely($$->push_back($3, thd->mem_root)))
- MYSQL_YYABORT;
-
- }
- | decode_when_list_oracle ',' expr
- {
- $$= $1;
- if (unlikely($$->push_back($3, thd->mem_root)))
- MYSQL_YYABORT;
- }
- ;
-
-
/* Equivalent to <table reference> in the SQL:2003 standard. */
/* Warning - may return NULL in case of incomplete SELECT */
Regards,
Sergei
Chief Architect, MariaDB Server
and secur...@mariadb.org
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org