QueryParser wrong for a case of JOIN

Description

{"WHERE":["AND",["=",[".machines.Type"],"machine"],["OR",["=",[".machines.Disabled"],false],[".machines.Disabled"]]],"WHAT":[[".machines.Id"],["AS",[".machines.Label"],"Label2"],[".machines.ModelId"],["AS",[".models.Label2"],"ModelLabel"]],"FROM":[{"AS":"machines"},{"AS":"models","ON":["=",[".models.Id"],[".machines.ModelId"]],"JOIN":"LEFT OUTER"}]}

is translated to

SELECT fl_result(fl_value(machines.body, 'Id')), fl_result(fl_value(machines.body, 'Label')) AS Label2, fl_result(fl_value(machines.body, 'ModelId')), fl_result(Label2) AS ModelLabel FROM kv_default AS machines LEFT OUTER JOIN kv_default AS models ON (fl_value(models.body, 'Id') = fl_value(machines.body, 'ModelId')) WHERE fl_value(machines.body, 'Type') = 'machine' AND (fl_value(machines.body, 'Disabled') = fl_bool(0) OR fl_value(machines.body, 'Disabled'))

and it ought to be

SELECT fl_result(fl_value(machines.body, 'Id')), fl_result(fl_value(machines.body, 'Label')) AS Label2, fl_result(fl_value(machines.body, 'ModelId')), fl_result(models.body, 'Label2') AS ModelLabel FROM kv_default AS machines LEFT OUTER JOIN kv_default AS models ON (fl_value(models.body, 'Id') = fl_value(machines.body, 'ModelId')) WHERE fl_value(machines.body, 'Type') = 'machine' AND (fl_value(machines.body, 'Disabled') = fl_bool(0) OR fl_value(machines.body, 'Disabled'))

Activity

Show:

CB robot April 25, 2022 at 8:22 PM

Build couchbase-lite-c-3.0.2-15 contains couchbase-lite-core commit 737ce1f with commit message:
: do not apply the rule of result alias if the property is e… (#1455)

CB robot April 25, 2022 at 2:09 PM

Build couchbase-lite-ios-3.0.1-22 contains couchbase-lite-core commit 737ce1f with commit message:
: do not apply the rule of result alias if the property is e… (#1455)

CB robot April 23, 2022 at 12:43 AM

Build couchbase-lite-core-3.0.2-11 contains couchbase-lite-core commit 737ce1f with commit message:
: do not apply the rule of result alias if the property is e… (#1455)

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Components

Fix versions

Affects versions

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created April 19, 2022 at 9:18 PM
Updated August 31, 2024 at 10:55 AM
Resolved April 22, 2022 at 11:28 PM
Instabug