Skip to content
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

"Error: column specified more than once in SELECT queries with joined tables" with livequeries #382

Open
LeonAlvarez opened this issue Oct 12, 2024 · 2 comments

Comments

@LeonAlvarez
Copy link

LeonAlvarez commented Oct 12, 2024

Issue Description

When using live queries, joins between tables that have columns with the same names fail. This issue occurs despite the query working correctly in PGLite itself, suggesting the problem may lie in the view creation process of the live plugin.

Example Query

The following query fails when used as a live query:

select "expense_shares"."id", "expense_shares"."expense_id", "expense_shares"."user_id", "expense_shares"."group_id", "expense_shares"."share_amount", "expense_shares"."created_at", "expense_shares"."updated_at", "expenses"."id", "expenses"."description", "expenses"."type", "expenses"."amount", "expenses"."payer_id", "expenses"."group_id", "expenses"."created_at", "expenses"."updated_at" from "expense_shares" inner join "expenses" on "expense_shares"."expense_id" = "expenses"."id" where "expense_shares"."user_id" = $1

Errors

error: column "id" specified more than once
error: column "group_d" specified more than once
error: column "created_at" specified more than once
error: column "updated_at" specified more than once
@LeonAlvarez
Copy link
Author

The workaround is to alias the columns with the clashing name, so that the columns names are unique

@ghardin1314
Copy link

Been running into this alot lately. Very inconvenient when trying to integrate with drizzle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants