-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: CTE source not available as function argument in JOIN target #70342
Comments
Looks like #59154 but this issue has a nice write up, so I'll close that one. |
How can the right hand side of a non-lateral join refer to the left-hand side? Using LATERAL works:
My guess is that it just happens to work in postgres for whatever reason. I didn't find anything in the pg documentation that would suggest it should. |
Maybe we should contribute a change to add the LATERAL keyword to the query? It shouldn't hurt anything when run against postgres. |
Ok, I found this in PG docs:
|
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes cockroachdb#70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes cockroachdb#70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
71396: opt: fix implicit lateral for SRFs when using JOIN syntax r=RaduBerinde a=RaduBerinde When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes #70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified). Co-authored-by: Radu Berinde <[email protected]>
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes #70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes #70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes cockroachdb#70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes cockroachdb#70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
When SRFs are used as a table, they imply that the join is lateral. This works for the multiple table syntax, but not for the JOIN syntax. This commit addresses this omission. Fixes #70342. Release note (bug fix): Fixes an incorrect "no data source matches prefix" error for queries that use a set-returning function on the right-hand side of a `JOIN` (unless `LATERAL` is explicitly specified).
NOTE: the underlying issue here may be misdiagnosed. Feel free to rename.
When passing the
Prefer: return=headers-only
orPrefer: return=representation
HTTP header on a POST request to request a newly inserted row's primary key, PostgREST issues the following query:Currently, this returns the following error:
I've simplified this down to the following incompatibility with Postgres:
CockroachDB:
Postgres:
It appears that Cockroach does not correctly propagate the CTE source into the JOIN target's scope, so it cannot find
data
injson_each_text(data.row)
.Epic CRDB-10300
The text was updated successfully, but these errors were encountered: