Hi, Oleksandr!
On Oct 01, Oleksandr Byelkin wrote:
> revision-id: 6f211b1f01b (mariadb-10.4.11-369-g6f211b1f01b)
> parent(s): 571764c04fc
> author: Oleksandr Byelkin <sanja@mariadb.com>
> committer: Oleksandr Byelkin <sanja@mariadb.com>
> timestamp: 2020-08-28 16:05:38 +0200
> message:
>
> MDEV-23518 Syntax error in ond SP results in misleading message on SHOW CREATE PROCEDURE
>
> Add info to the error message how to get details about error which happened.
>
> diff --git a/mysql-test/main/errors.test b/mysql-test/main/errors.test
> index f3aedc8e491..a4b95d48e5d 100644
> --- a/mysql-test/main/errors.test
> +++ b/mysql-test/main/errors.test
> @@ -246,3 +246,39 @@ SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,nu
> SELECT UPDATEXML(-73 * -2465717823867977728,@@global.long_query_time,null);
>
> -- echo # End of 10.3 tests
> +
> +--echo #
> +--echo # MDEV-23518: Syntax error in ond SP results in misleading
> +--echo # message on SHOW CREATE PROCEDURE
> +--echo #
> +
> +DELIMITER $$;
> +
> +CREATE PROCEDURE P1 ()
> +BEGIN NOT ATOMIC
> + IF (SELECT 2) THEN
> + SELECT 4;
> + END IF ;
> +END;
> +$$
> +
> +DELIMITER ;$$
you could've had just CREATE PROCEDURE P1 () SELECT 1;
one line, no need to change a delimiter. You overwrite the body below
anyway :)
I just keep it close to original (do not take much time)
> +
> +select name,db,body from mysql.proc where name = "P1";
> +update mysql.proc set body_utf8="BEGIN NOT ATOMIC
> +IF (SELECT 2) OR foo = 3 THEN
> +SELECT 4;
> +END IF ;
> +END", body="BEGIN NOT ATOMIC
> +IF (SELECT 2) OR foo = 3 THEN
> +SELECT 4;
> +END IF ;
> +END"where name = "P1";
> +
> +--error ER_SP_PROC_TABLE_CORRUPT
> +show create procedure P1;
> +show warnings;
> +
> +drop procedure P1;
> +
> diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
> index ddc52702e42..582c80e2ad8 100644
> --- a/sql/share/errmsg-utf8.txt
> +++ b/sql/share/errmsg-utf8.txt
> @@ -5714,8 +5714,7 @@ ER_SP_RECURSION_LIMIT
> eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.192s"
> ger "Rekursionsgrenze %d (durch Variable max_sp_recursion_depth gegeben) wurde für Routine %.192s überschritten"
> ER_SP_PROC_TABLE_CORRUPT
> - eng "Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
> - ger "Routine %-.192s konnte nicht geladen werden. Die Tabelle mysql.proc fehlt, ist beschädigt, oder enthält fehlerhaften Daten (interner Code: %d)"
> + eng "Failed to load routine %-.192s. The table mysql.proc is missing, corrupt, etc. (internal code %d). For more details, run SHOW WARNINGS"
Okay, so you just extended the error message.
Perhaps "The table mysql.proc is missing, corrupt, etc." is now
redundant and shoud go away too?
Yes, probably it is better to avoid false tips...
Regards,
Sergei
VP of MariaDB Server Engineering
and security@mariadb.org