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

Scalar Subqueries in Select List fail with a "Column does not exist" error #441

Open
zoe-j-m opened this issue Feb 17, 2025 · 0 comments
Open

Comments

@zoe-j-m
Copy link

zoe-j-m commented Feb 17, 2025

Describe the bug

Scalar subqueries are subqueries usually in the select list, which select a single column and should return at most 1 row.
This bug causes kysely's migrations to fail.

Error: column "a.id" does not exist

🐜 This seems to be an execution error, which means that your request syntax seems okay,
    but the resulting statement cannot be executed → Probably not a pg-mem error.

To Reproduce

(The inserts aren't really needed to produce the error, but mean that the pg version returns nice results)

create table test(id text); 
create table test2(id text);
insert into test values ('value');    
insert into test2 values ('value');
insert into test2 values ('value2');
select a.id,
  (
    select
      true as "something"
    from
      "test"
    where
      "id" = a.id 
  ) as "something"
from
  test2 as a;

Expected result:

id	something
value	true
value2	null

pg-mem version

3.0.4

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