Description:
SHOW CREATE LIBRARY can emit invalid CREATE syntax when the library body ends in '$'.
For the body '// $', SHOW CREATE LIBRARY emits:
CREATE LIBRARY `lib1`
LANGUAGE JAVASCRIPT
AS $$// $$$
Replaying this definition fails because the first two trailing dollar signs close the dollar-quoted body, leaving a stray '$':
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$' at line 3
SHOW CREATE output for an accepted library should be valid CREATE syntax and recreate the same body. A control body ending in 'x' is emitted as AS $$// x$$ and replays successfully.
How to repeat:
CREATE DATABASE db1;
USE db1;
CREATE LIBRARY lib1 LANGUAGE JAVASCRIPT AS '// $';
SHOW CREATE LIBRARY lib1;
-- Emits: AS $$// $$$
DROP LIBRARY lib1;
CREATE LIBRARY `lib1`
LANGUAGE JAVASCRIPT
AS $$// $$$;
-- Fails with ERROR 1064 (42000) near '$' at line 3
-- Control:
CREATE LIBRARY lib2 LANGUAGE JAVASCRIPT AS '// x';
SHOW CREATE LIBRARY lib2;
-- Emits: AS $$// x$$
DROP LIBRARY lib2;
CREATE LIBRARY `lib2`
LANGUAGE JAVASCRIPT
AS $$// x$$;
-- Succeeds
Page generated in 0.037 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders. It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: SHOW CREATE LIBRARY can emit invalid CREATE syntax when the library body ends in '$'. For the body '// $', SHOW CREATE LIBRARY emits: CREATE LIBRARY `lib1` LANGUAGE JAVASCRIPT AS $$// $$$ Replaying this definition fails because the first two trailing dollar signs close the dollar-quoted body, leaving a stray '$': ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$' at line 3 SHOW CREATE output for an accepted library should be valid CREATE syntax and recreate the same body. A control body ending in 'x' is emitted as AS $$// x$$ and replays successfully. How to repeat: CREATE DATABASE db1; USE db1; CREATE LIBRARY lib1 LANGUAGE JAVASCRIPT AS '// $'; SHOW CREATE LIBRARY lib1; -- Emits: AS $$// $$$ DROP LIBRARY lib1; CREATE LIBRARY `lib1` LANGUAGE JAVASCRIPT AS $$// $$$; -- Fails with ERROR 1064 (42000) near '$' at line 3 -- Control: CREATE LIBRARY lib2 LANGUAGE JAVASCRIPT AS '// x'; SHOW CREATE LIBRARY lib2; -- Emits: AS $$// x$$ DROP LIBRARY lib2; CREATE LIBRARY `lib2` LANGUAGE JAVASCRIPT AS $$// x$$; -- Succeeds