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

Incorrect SQL is generated in custom query if * is used on one of the tables in a join #2

Open
bryanhughes opened this issue Sep 17, 2024 · 0 comments

Comments

@bryanhughes
Copy link
Owner

The query:

SELECT c.* FROM public.channel c, public.channel_member cm  WHERE cm.user_uuid = $user_uuid AND c.company_id = $company_id AND c.channel_uuid = cm.channel_uuid

Results in

WARNING: Failed parse custom query. Reason={error,error,<<"42702">>,
                                                ambiguous_column,
                                                <<"column reference \"version\" is ambiguous">>,
                                                [{file,<<"parse_relation.c">>},
                                                 {line,<<"898">>},
                                                 {position,<<"114">>},
                                                 {routine,<<"colNameToVar">>},
                                                 {severity,<<"ERROR">>}]}, Stmt="SELECT c.channel_uuid, company_id, started_on, last_message_on, total_tokens, model, system_prompt, user_prompt, version FROM public.channel c, public.channel_member cm "```
All columns should be prefixed with the tables alias
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

1 participant