Statement splitting bug: SQL string literal grammar is RDBMS-dependent

Description

The following commit fixed a bug introduced in 3.5.0 for MySQL, but it introduced a bug for others:
https://github.com/liquibase/liquibase/commit/45b1d911b73791d19af23e4e2de2fe6de3e5ed83

Corresponding Jira issue:
https://liquibase.jira.com/browse/CORE-2843

The ANSI SQL grammar does not allow single quotes to be escaped with a backslash in a string literal. I haven't obtained an actual copy of the standard myself, but that claim is also made in the SQLite Documentation ("C-style escapes using the backslash character are not supported because they are not standard SQL"): https://www.sqlite.org/lang_expr.html

Some RDBMS vendors have a modified grammar that allows backslash escape sequences, such as MySQL, but most don't in compliance with the standard, including at least SQLite, Oracle, and SQL Server.

This will cause problems for string literals ending in a backslash, which are not uncommon in Windows environments. The most significant problem is statements being split incorrectly. I encountered this bug with the string literal '\' occurring in a group of stored procedures for SQL Server.

Environment

All, especially Windows

Status

Assignee

Unassigned

Reporter

Luke Hiester

Labels

None

Components

Affects versions

3.5.2
3.5.3
3.6.0
3.5.4
3.5.5
3.6.2
3.6.3
3.6.1

Priority

Major