Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-45556

Parser is not handling parens in the FROM clause which is part of ANSI SQL

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      This example query

      SELECT count (*)
      FROM nation n1
       join nation n2
       on ((n1.n_name = 'Germany' AND n2.n_name = 'Cambodia') OR (n1.n_name = 'Cambodia' AND n2.n_name = 'Germany'))
       join (customer c
       join orders o
       on c.c_id = o.o_c_id AND c.c_w_id = o.o_w_id AND c.c_d_id = o.o_d_id)
       on string_to_codepoint(c.c_state)[0] = n2.n_nationkey ;
      

      produces a syntax error

      msg": "Syntax error: In line 5 >> join (customer c<< Encountered <IDENTIFIER> \"c\" at column 17. ",
       "query_from_user": "SELECT count (*)\nFROM nation n1\n join nation n2\n on ((n1.n_name = 'Germany' AND n2.n_name = 'Cambodia') OR (n1.n_name = 'Cambodia' AND n2.n_name = 'Germany'))\n join (customer c\n join orders o\n on c.c_id = o.o_c_id AND c.c_w_id = o.o_w_id AND c.c_d_id = o.o_d_id)\n on string_to_codepoint(c.c_state)[0] = n2.n_nationkey ;"
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ali.alsuliman Ali Alsuliman
            murali.krishna Murali Krishna
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty