-
Notifications
You must be signed in to change notification settings - Fork 881
sqlite: column "id" does not exist
for left-joined query
#2271
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
Comments
If I alias the -- name: User :one
SELECT
u.id, u.username, u.email, u.real_name, u.pronouns, u.avatar_url, u.joined_at,
user_tiers.started_at AS tier_started_at,
user_tiers.renewed_at AS tier_renewed_at,
tiers.id AS tier_id,
tiers.name AS tier_name,
tiers.price AS tier_price,
tiers.description AS tier_description
FROM users AS u
LEFT JOIN user_tiers ON users.id = user_tiers.user_id
LEFT JOIN tiers ON user_tiers.tier_id = tiers.id
WHERE users.id = ?; Doing |
here's a distilled example: -- name: User :one
SELECT users.id
FROM users
LEFT JOIN tiers ON tiers.id == users.id
WHERE users.id = ?; It appears that the join statement causes the column search to fail in |
column "id" does not exist
for inner-joined querycolumn "id" does not exist
for left-joined query
orisano
added a commit
to orisano/sqlc
that referenced
this issue
Jul 15, 2023
changed rules to conform to fallback directive behavior fix sqlc-dev#2271
orisano
added a commit
to orisano/sqlc
that referenced
this issue
Jul 15, 2023
changed rules to conform to fallback directive behavior fix sqlc-dev#2271
kyleconroy
added a commit
to orisano/sqlc
that referenced
this issue
Jul 24, 2023
kyleconroy
added a commit
that referenced
this issue
Jul 24, 2023
* fix(engine/sqlite): fix table_alias rules changed rules to conform to fallback directive behavior fix #2271 * test: update endtoend * Update parser code --------- Co-authored-by: Kyle Conroy <kyle@sqlc.dev>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Version
1.17.2 (also happens with 1.18.0)
What happened?
With the query posted below,
sqlc
will return the following error:Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/96a33a86cc6f0f8bf7ba2260d9341aa8ea88d6ad36747d5da92ea56e411d6efe
What operating system are you using?
Linux
What database engines are you using?
SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: