-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embedding of views through composite keys with different column order broken #2518
Comments
Note, that this bug only surfaced for me, because the column types were not matching. If the column types match, this will silently succeed, but might return wrong results. |
I was not able to reproduce this with plain tables only, i.e. without views. |
@wolfgangwalther Is this one a regression? Does it happen on v9 too? |
I'm currently on pg14/pgrst9 - and it works fine there. This appeared when trying to upgrade. I tried both 10.0.0 and the current pre-release. Seems to be a regression from v9 to v10. Seems to be independent of pg14 vs pg15. I haven't gone further, so far, but it should be simple to put the test case into the fixtures and bisect the commit where this started happening. |
|
The important bit seems to be the view "relColumns": [
[
"c1",
"c2"
],
[
"c2",
"c1"
]
], All other relationships, including "relColumns": [
[
"c2",
"c2"
],
[
"c1",
"c1"
]
], |
One thing to note from my schema cache example above: In almost all cases the order of columns is |
This fixes a regression introduced in d271942. The order of relColumns in the schema cache is now consistently matching the order of columns in foreign key definitions. Resolves PostgREST#2518 Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This fixes a regression introduced in d271942. The order of relColumns in the schema cache is now consistently matching the order of columns in foreign key definitions. Resolves PostgREST#2518 Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This fixes a regression introduced in d271942. The order of relColumns in the schema cache is now consistently matching the order of columns in foreign key definitions. Resolves PostgREST#2518 Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
Environment
Description of issue
Taking the following schema:
and doing the following request:
throws the following error:
This is because the query generated for this embedding looks like this:
The
WHERE
for that join is just flat out wrong - it comparesc1
andc2
with each other?The text was updated successfully, but these errors were encountered: