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
As you can see in the generated sql it does an unnecessary JOIN on the user table. The JOIN is unnecessary because we are matching its primary key.
Expected behavior
Avoid a second JOIN when matching PKs.
Additional context
The expected behaviour is surely a desiderable one, but I do get why for semplicity this has been done: if you want to match a PK just use a scalar instead of explicitly specify the PK column.
The problem is that you cannot match null values unless you explicitely specify the PK column, see #548
So fixing this could help to achieve LEFT JOIN / IS NULL-like constraints (see https://explainextended.com/2009/09/15/not-in-vs-not-exists-vs-left-join-is-null-sql-server/) necessary to implement the following type of JOIN:
In fact the following snippet succeeds in implementing a LEFT JOIN / IS NULL-like constraint, except for the unnecessary JOIN which is the reason of this bug report:
The previous query matches a primary key on the M:N
deletions
field, without explicitly mentioning the PK column. This is the sql it generates:In the following one, instead, we explictly specify the PK column (
id
):As you can see in the generated sql it does an unnecessary JOIN on the user table. The JOIN is unnecessary because we are matching its primary key.
Expected behavior
Avoid a second JOIN when matching PKs.
Additional context
The expected behaviour is surely a desiderable one, but I do get why for semplicity this has been done: if you want to match a PK just use a scalar instead of explicitly specify the PK column.
The problem is that you cannot match
null
values unless you explicitely specify the PK column, see #548So fixing this could help to achieve
LEFT JOIN / IS NULL
-like constraints (see https://explainextended.com/2009/09/15/not-in-vs-not-exists-vs-left-join-is-null-sql-server/) necessary to implement the following type of JOIN:In fact the following snippet succeeds in implementing a
LEFT JOIN / IS NULL
-like constraint, except for the unnecessary JOIN which is the reason of this bug report:Versions
The text was updated successfully, but these errors were encountered: