Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4247

When parsing SQL in BigQuery dialect, character literals may be enclosed in single- or double-quotes, and use backslashes as escapes

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.26.0
    • Component/s: babel
    • Labels:
      None

      Description

      When parsing SQL in BigQuery dialect, character literals may be enclosed in single- or double-quotes, and use backslashes as escapes. In standard SQL, and most dialects, character literals are enclosed in single-quotes only, and use single-quotes as the escape character.

      For example:

      'Let''s call him "Elvis"!' /* valid in Oracle, PostgreSQL, etc. */
      'Let\'s call him "Elvis"!' /* valid in BigQuery */
      "Let's call him \"Elvis\"!" /* valid in BigQuery */
      

      To control this feature, we add

      enum CharLiteralStyle { STANDARD, BQ_SINGLE, BQ_DOUBLE }
      

      and to interface SqlParser.Config we add method Set<CharLiteralStyle> charLiteralStyles().

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                julianhyde Julian Hyde
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: