oguimbal / pg-mem

An in memory postgres DB instance for your unit tests
MIT License
1.98k stars 97 forks source link

Using "using" on joins leads to wrong "ambiguous reference" errors #405

Open rswheeldon opened 4 months ago

rswheeldon commented 4 months ago

Describe the bug

Doing a join with "using" for a column ID implies it's not ambiguous - it doesn't matter which one you pick because they're the same. Postgres realizes this but pg-mem doesn't.

column reference "x" is ambiguous

🐜 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.

*️⃣ Reconsituted failed SQL statement: SELECT x  FROM foo  INNER JOIN bar  USING (x)

To Reproduce

create table foo(x integer);
create table bar (x integer);

select x from foo join bar using (x);

pg-mem version

2.8.1 (reproducible in playground at time of writing)