You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CreateTitle query INSERT INTO titles (id, name, author_id) VALUES ($1, $2, (SELECT author_id FROM authors WHERE name = $3)); is flagged:
query.sql:22:95: column reference "name" is ambiguous
I don't believe it's ambiguous in the context of the sub-select.
Note that I see this problem with CTEs as well, I can provide an example if needed.
Relevant log output
query.sql:22:95: column reference "name" is ambiguous
Database schema
CREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
bio text
);
CREATETABLEtitles (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
author_id BIGINTNOT NULL ,
CONSTRAINT fk_authors FOREIGN KEY(author_id) REFERENCES authors(id)
);
SQL queries
INSERT INTO titles (id, name, author_id) VALUES ($1, $2, (SELECT author_id FROM authors WHERE name = $3));
Version
1.25.0
What happened?
Here's an example: https://play.sqlc.dev/p/f32a811caf892026c11495a0059cc4eb041ba647e746f47316873f7bc85bd3bd
The CreateTitle query
INSERT INTO titles (id, name, author_id) VALUES ($1, $2, (SELECT author_id FROM authors WHERE name = $3));
is flagged:I don't believe it's ambiguous in the context of the sub-select.
Note that I see this problem with CTEs as well, I can provide an example if needed.
Relevant log output
query.sql:22:95: column reference "name" is ambiguous
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/f32a811caf892026c11495a0059cc4eb041ba647e746f47316873f7bc85bd3bd
What operating system are you using?
Linux, macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: