You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed some odd errors where Flyway was failing to parse our SQL migrations properly, and ended up concatenating 30,000 lines of SQL together into a single procedure. I traced this down to a bug with parsing string tokens, as evidenced by the following script that should parse as 2 sql statements
CREATE OR REPLACE PROCEDURE FOOBAR
(
FOO IN OUT VARCHAR2,
BAR IN OUT VARCHAR2
)
AS
BEGIN
IF FOO = 'FOO'THEN
BAR := 'BAR';
END IF;
END;
/
CREATE OR REPLACE PROCEDURE BARBAZ
(
BAR IN OUT VARCHAR2,
BAZ IN OUT VARCHAR2
)
AS
BEGIN
IF BAR = 'BAR'THEN
BAZ := 'BAZ';
END IF;
END;
/
Notice the lack of a space between the ' and the subsequent THEN. This causes Flyway to think it is still inside of a quoted string literal and therefore it continues to parse all of the rest of the file as being part of the current statement.
I can obviously rewrite the original SQL, but it would be nice to fix the tokenizer to work properly. Every other tool I use parses this statement properly, including IntelliJ, SQL Developer, sqlplus, etc. Having a sql statement work properly in the developer tool, but fail in exciting way when run as part of a migration is obviously not a great behavior.
The text was updated successfully, but these errors were encountered:
I noticed some odd errors where Flyway was failing to parse our SQL migrations properly, and ended up concatenating 30,000 lines of SQL together into a single procedure. I traced this down to a bug with parsing string tokens, as evidenced by the following script that should parse as 2 sql statements
Notice the lack of a space between the
'
and the subsequentTHEN
. This causes Flyway to think it is still inside of a quoted string literal and therefore it continues to parse all of the rest of the file as being part of the current statement.I can obviously rewrite the original SQL, but it would be nice to fix the tokenizer to work properly. Every other tool I use parses this statement properly, including IntelliJ, SQL Developer, sqlplus, etc. Having a sql statement work properly in the developer tool, but fail in exciting way when run as part of a migration is obviously not a great behavior.
The text was updated successfully, but these errors were encountered: