Uploaded image for project: 'Liquibase Core'
  1. CORE-3417

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 3.5.2, 3.5.3, 3.5.4, 3.5.5, 3.6.0, 3.6.1, 3.6.2, 3.6.3
    • Fix versions: None
    • Components: Database Support
    • Environment:

      All, especially Windows

    • Sprint:

      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.

        Attachments

          Activity

            People

            • Reporter:
              lehiester Luke Hiester
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: