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

WITH clause is applied only FIRST arm of the SET OP queries

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 7.1.0
    • 6.6.5, 7.0.3, 7.1.0
    • query
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      Found by Geoffrey Beers

      with s as ([{"a":1}, {"a":2}]) 
      select s1.a from s  AS s1 where s1.a = 1 
      union all 
      select s1.a + 10 from s  AS s1 where s1.a = 2;
      {
          "requestID": "b709cb2b-390e-44b0-8b1d-964904f52d2c",
          "errors": [
              {
                  "code": 12003,
                  "msg": "Keyspace not found in CB datastore: default:s - cause: No bucket named s"
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "33.12533ms",
              "executionTime": "33.052704ms",
              "resultCount": 0,
              "resultSize": 0,
              "serviceLoad": 2,
              "errorCount": 1
          }
      }
      

      The following works, but extra over head of CTE

      with s as ( [{"a":1}, {"a":2}] ) 
      select s1.a from s  AS s1 where s1.a = 1 
      union all 
      with s as ( [{"a":1}, {"a":2}] ) 
      select s1.a + 10 from s  AS s1 where s1.a = 2;
      
      

      Attachments

        Issue Links

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

          Activity

            People

              kamini.jagtiani Kamini Jagtiani
              Sitaram.Vemulapalli Sitaram Vemulapalli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty