Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-5335

array_agg seem to fail under some circumstances

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Beryllium
    • Beryllium
    • LiteCore
    • Security Level: Public
    • None
    • LiteCore 124, LiteCore 125
    • 4

    Description

      array_agg can throw the exception: "ERROR: array_agg: exception! (1/1)"

       

      Statements to create the example data:

      put "A" {"test":"test"}
      put "B" {"a_id":"A"}
      put "C" {"a_id":"A"}

      Example query:

       

      SELECT array_agg(b) FROM _default AS a LEFT JOIN _default AS b ON b.a_id = META(a).id GROUP BY a 

       

      Output of "cblite":

      [DB] ERROR: SQLite error (code 1): statement aborts at 47: [SELECT fl_result(fl_root(a.body)), fl_result(array_agg(fl_root(b.body))) FROM kv_default AS a LEFT JOIN kv_default AS b ON (fl_value(b.body, 'a_id') = a.key) AND (b.flags & 1 = 0) WHERE (a.flags & 1 = 0) GROUP BY fl_root(a.body)] array_agg: exception!
      [SQL] ERROR: array_agg: exception! (1/1)
      [SQL] ERROR: array_agg: exception! (1/1)
      Error starting query: array_agg: exception! (/1) 

       

      Example script (with additional debug output) here:

      https://colab.research.google.com/drive/1px5NCazezEOnfUHVQRoZHMJ-UXtVWkyq?usp=sharing

       

       

      Attachments

        Activity

          People

            callum.birks Callum Birks
            CrazyT CrazyT
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty