Skip to content

Creating a view with a UNION no longer compiles #2664

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

Closed
sergeleger opened this issue Aug 28, 2023 · 0 comments · Fixed by #2673
Closed

Creating a view with a UNION no longer compiles #2664

sergeleger opened this issue Aug 28, 2023 · 0 comments · Fixed by #2673
Labels
bug Something isn't working triage New issues that hasn't been reviewed

Comments

@sergeleger
Copy link

sergeleger commented Aug 28, 2023

Version

1.20.0

What happened?

Upgraded to sqlc 1.20.0 and a view that was previously compiling under 1.18.0 now creates an error column reference "name" is ambiguous

-- `union` works in sqlc 1.18.0, 1.19.0 and 1.19.1
create view all_staff as
    select name, lname, pos from employees
    union 
    select name, lname, title as pos from managers;

Also, while investigating this bug noticed that union and union all have different error handling in versions prior to 1.20.0.

Relevant log output

# package db
query.sql:15:12: column reference "name" is ambiguous

Database schema

create table employees (
    name  text,
    lname text,
    pos   text
);

create table managers (
    name  text,
    lname text,
    title text
);

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/48bae081f4aec4493fb0f202219c82267c25358eace80b7841679034b1c1a82d

What operating system are you using?

Linux

What database engines are you using?

SQLite

What type of code are you generating?

Go

@sergeleger sergeleger added bug Something isn't working triage New issues that hasn't been reviewed labels Aug 28, 2023
orisano added a commit to orisano/sqlc that referenced this issue Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that hasn't been reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant