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

Very confusing error messages related to variables/aliases

    XMLWordPrintable

Details

    • Untriaged
    • Unknown
    • CX Sprint 107, CX Sprint 108, CX Sprint 109, CX Sprint 110, CX Sprint 111

    Description

      The following (broken) SQL++ query:

      USE hw5;

      FROM world AS x,
           x.mondial.country AS z,
      {{     x.mondial.mountain AS y }}
      GROUP BY z.name
      SELECT z.`-car_code` AS country_code,
             z.name AS country_name,
             y.name AS mountain, y.height AS height;

      Gives this very confusing error message:

      "Cannot resolve ambiguous alias reference for undefined identifier z in [#1, $name][CompilationException]"
       

      This is confusing in multiple ways:
      1. What the heck is #1?  And ditto for $name?
      2. What is the meaning of the use of the array constructor in the error message?  () Note that these users are making heavy use of array constructor syntax, so [ ]'s are common in their queries - we shouldn't use it in our error messages ever unless we're complaining about the user's array constructors IMO.
      3. What line is the error on - is this before or after the GROUP BY?  (It's after.)
      4. "I defined z, so why is it undefined?" (Asked the user. )

      For setup, do this:

      DROP DATAVERSE hw5 IF EXISTS;
      CREATE DATAVERSE hw5;
      USE hw5;
      CREATE TYPE worldType AS {auto_id:uuid };
      CREATE DATASET world(worldType) PRIMARY KEY auto_id AUTOGENERATED;
       

      Attachments

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

        Activity

          People

            tanzeem.ahmed Tanzeem Ahmed (Inactive)
            mike.carey Mike Carey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty