Open
Description
Given the rule:
It is necessary that each plan that includes a plan feature that provides a feature1, includes at most one plan feature that provides the feature1
(using the model from https://github.com/resin-io/resin-api/pull/1020)
we end up with the following SQL:
SELECT NOT EXISTS (
SELECT 1
FROM "plan" AS "plan.0",
"plan feature" AS "plan feature.1",
"feature" AS "feature.2",
"plan-includes-plan feature" AS "plan.0-includes-plan feature.1"
WHERE "plan feature.1"."provides-feature" = "feature.2"."id"
AND "plan.0-includes-plan feature.1"."plan" = "plan.0"."id"
AND "plan.0-includes-plan feature.1"."plan feature" = "plan feature.1"."id"
AND (
SELECT COUNT(*)
FROM "plan feature" AS "plan feature.3",
"plan-includes-plan feature" AS "plan.0-includes-plan feature.3"
WHERE "plan feature.3"."provides-feature" = "feature.2"."id"
AND "plan.0-includes-plan feature.3"."plan" = "plan.0"."id"
AND "plan.0-includes-plan feature.3"."plan feature" = "plan feature.3"."id"
) >= 2
) AS "result";
This doesn't work. plan-includes-plan feature
has two field, plan
and includes-plan feature
, but this references a non-existent plan feature
field.
This is a bug at the LF level, which is making some assumptions about FK field names that are no longer true.
Metadata
Metadata
Assignees
Labels
No labels