You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeQuery {
# Observations grouped by commonly held constraintsconstraintSetGroups(
programId: ProgramId!
...
): [ConstraintSetGroup!]!
}
# example queryquery {
constraintSetGroups(programId: "p-101") {
observations {
id
}
}
}
The elaborator discards all the arguments for now, so Select(constraintSetGroups, Nil, child) is what the compiler is seeing.
If I comment out 1 above, the query is correctly compiled to:
SELECTv_observation.c_observation_id,
v_constraint_set_group.c_conditions_key,
v_constraint_set_group.c_program_idFROM
v_constraint_set_group
LEFT JOIN v_observation ON (
v_observation.c_conditions_key=v_constraint_set_group.c_conditions_key
)
If I comment out 2 above, the query is correctly compiled to:
SELECTv_observation.c_observation_id,
v_constraint_set_group.c_conditions_key,
v_constraint_set_group.c_program_idFROM
v_constraint_set_group
LEFT JOIN v_observation ON (
v_observation.c_program_id=v_constraint_set_group.c_program_id
)
However if I leave them both in, it's compiled to this, which is invalid SQL because table v_constraint_set_group is introduced twice. It's also quite complicated.
SELECTv_observation_v_constraint_set_group_nested.c_observation_id,
v_constraint_set_group.c_conditions_key,
v_constraint_set_group.c_program_idFROM
v_constraint_set_group
LEFT JOIN v_constraint_set_group ON (
v_constraint_set_group.c_program_id=v_constraint_set_group.c_program_id
)
LEFT JOIN LATERAL (
SELECTv_observation.c_conditions_keyAS c_conditions_key_alias_0,
v_observation.c_observation_idFROM
v_observation
INNER JOIN v_constraint_set_group ON (
v_constraint_set_group.c_conditions_key=v_observation.c_conditions_key
)
) AS v_observation_v_constraint_set_group_nested ON (
v_observation_v_constraint_set_group_nested.c_conditions_key_alias_0=v_constraint_set_group.c_conditions_key
)
I would have expected something like:
SELECTv_observation.c_observation_id,
v_constraint_set_group.c_conditions_key,
v_constraint_set_group.c_program_idFROM
v_constraint_set_group
LEFT JOIN v_observation ON (
v_observation.c_conditions_key=v_constraint_set_group.c_conditions_key,
v_observation.c_program_id=v_constraint_set_group.c_program_id
)
The text was updated successfully, but these errors were encountered:
This seems like a bug because it's producing invalid SQL, but it's also possible I'm doing something wrong.
I have the following mapping, where views are joined by a compound key. Note lines marked as 1 and 2.
GraphQL Schema and query look like this:
The elaborator discards all the arguments for now, so
Select(constraintSetGroups, Nil, child)
is what the compiler is seeing.If I comment out
1
above, the query is correctly compiled to:If I comment out
2
above, the query is correctly compiled to:However if I leave them both in, it's compiled to this, which is invalid SQL because table
v_constraint_set_group
is introduced twice. It's also quite complicated.I would have expected something like:
The text was updated successfully, but these errors were encountered: