Bug #101001 | mysqlsh does not correctly parse create procedure statement in sql context | ||
---|---|---|---|
Submitted: | 29 Sep 2020 19:56 | Modified: | 30 Sep 2020 12:14 |
Reporter: | Michael McLaughlin | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Document Store: MySQL Shell | Severity: | S3 (Non-critical) |
Version: | 8.0.21 | OS: | Windows (10) |
Assigned to: | CPU Architecture: | Any | |
Tags: | MySQL Server Shell, stored procedures |
[29 Sep 2020 19:56]
Michael McLaughlin
[29 Sep 2020 22:32]
Alfredo Kojima
In your script, the SELECT and the CREATE PROCEDURE end up in the same SQL statement because the SELECT is terminated with ; when the delimiter was changed to $$. If you move the SELECT to before the DELIMITER directive or change the delimiter in the SELECT to $$ it should work fine: DELIMITER $$ SELECT 'CREATE PROCEDURE test' AS "Statement"$$ CREATE PROCEDURE test ( pv_input1 CHAR(12) , pv_input2 CHAR(19)) MODIFIES SQL DATA BEGIN SELECT pv_input1; END; $$ The reason this works with the mysql client is that it enables CLIENT_MULTI_STATEMENTS while mysqlsh doesn't in order to minimize potential damage from SQL injection attempts in user scripts.
[29 Sep 2020 23:05]
Michael McLaughlin
THANKS Alfredo for the explaining the difference. I checked the MySQL Shell manual and didn't find a reference to that. Maybe there should be a note added to this document to explain that it doesn't support CLIENT_MULTI_STATEMENTS. https://docs.oracle.com/cd/E17952_01/mysql-shell-8.0-en/mysql-shell-8.0-en.pdf That fixed my problem.
[30 Sep 2020 12:14]
MySQL Verification Team
Thank you Mr. McLoughlin and Alfredo, This bug report is closed now. Not a bug.