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

SQL++ Alignment: UNION ALL is not working for all the query types. Keyword error UNION.

    XMLWordPrintable

Details

    • Untriaged
    • Unknown
    • CX Sprint 96, CX Sprint 97, CX Sprint 116, CX Sprint 117

    Description

      Analytics Query:

      (SELECT * FROM  simple_table_db_83597457_simple_table_shadow   WHERE  ((((decimal_field1 > 4912) OR (decimal_field1 = 4912)) OR (int_field1 = 52000873) OR char_field1 < "N")) OR (bool_field1 != false)    ORDER BY   int_field1  DESC)  
      UNION ALL 
      (SELECT * FROM  simple_table_db_83597457_simple_table_shadow   WHERE  ((primary_key_id NOT BETWEEN "1" and "999" AND decimal_field1 >= 4912)) AND ((bool_field1 OR (int_field1  IN [  44752 , 55191 , 56574 , 57419 , 544073  ]) OR (int_field1 IS NULL))) OR ((int_field1 < 52000873) AND (int_field1 > 52000873)) AND ((bool_field1 = false AND decimal_field1 IS NOT NULL))    ORDER BY   int_field1 , decimal_field1 ,  varchar_field1 , char_field1 )
      

      When I run the 2 queries separately I am getting the results. The first query generated some data and the second query returns empty data "results": [].

      Error:

      [
        {
          "code": 1,
          "msg": "Syntax error: In line 2 >>UNION ALL << Encountered \"UNION\" at column 1. ",
          "query_from_user": "(SELECT * FROM  simple_table_db_83597457_simple_table_shadow   WHERE  ((((decimal_field1 > 4912) OR (decimal_field1 = 4912)) OR (int_field1 = 52000873) OR char_field1 < \"N\")) OR (bool_field1 != false)    ORDER BY   int_field1  DESC)  \nUNION ALL \n(SELECT * FROM  simple_table_db_83597457_simple_table_shadow   WHERE  ((primary_key_id NOT BETWEEN \"1\" and \"999\" AND decimal_field1 >= 4912)) AND ((bool_field1 OR (int_field1  IN [  44752 , 55191 , 56574 , 57419 , 544073  ]) OR (int_field1 IS NULL))) OR ((int_field1 < 52000873) AND (int_field1 > 52000873)) AND ((bool_field1 = false AND decimal_field1 IS NOT NULL))    ORDER BY   int_field1 , decimal_field1 ,  varchar_field1 , char_field1 )"
        }
      ]
      

      The same query works fine on SQL.

      Attachments

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

        Activity

          People

            ali.alsuliman Ali Alsuliman
            ritesh.agarwal Ritesh Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty