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

Order by projection expression some times returns error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • bug-backlog
    • 6.6.2, Cheshire-Cat
    • query
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      EXPLAIN
      SELECT d.c1,
             MAX([d.c2,d])[1].*
      FROM default AS d
      GROUP BY d.c1
      ORDER BY d.c1, date;
       
      "errors": [
              {
                  "code": 4210,
                  "msg": "Expression (`d`.`date`) must depend only on group keys or aggregates."
              }
          ]
       
       
       
      explain SELECT t1.`key`, COUNT(t3) AS ntrips, MAX([t3.date, {t3.date, t1.yearborn, udata.name, udata.email, udata.phone}])[1].* FROM default AS t1 LEFT JOIN default AS t3 ON t1.`key` = t3.userkey AND t3.type = 'FishingTrip' LET udata = (SELECT up.name, up.email,IFMISSINGORNULL(up.cellphone, IFMISSINGORNULL(up.phone,'-')) AS phone FROM default AS up USE KEYS 'User:Private:' || t1.`key` WHERE up.type='Private')[0] WHERE t1.type = 'User' GROUP BY t1.`key` ORDER BY t1.`key`, date DESC;
      {
          "requestID": "229e59e4-ca60-43e9-a3e9-820478f28cf3",
          "errors": [
              {
                  "code": 3000,
                  "msg": "Ambiguous reference to field date."
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "2.679651ms",
              "executionTime": "2.621667ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      
      

      date expression should pick from projection

      https://forums.couchbase.com/t/add-join-to-find-newest-related-record-and-count-of-same/30688/4

      Attachments

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

        Activity

          People

            Donald.haggart Donald Haggart
            Sitaram.Vemulapalli Sitaram Vemulapalli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty