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
When joining together two tables where both tables contain column named source, compile fails with Ambiguous name error.
I've tried to wrap the column name with whatever i could come up, even good old backtick does not help.
PRQL input
prql target:sql.postgres
let a =(
from events_a
select {
event_id,
source,})let b =(
from events_b
select {
event_id,
source,})from a
join b (==event_id)select {
event_id = a.event_id,
source_a = a.source,}
SQL output
prql target:sql.postgres
Ambiguous name
Expected SQL output
No response
MVCE confirmation
Minimal example
New issue
Anything else?
Smallest example i could come up with is to join table with itself
prql target:sql.postgres
let a =(
from events_a
select {
event_id,
source,})from a
join a (==event_id)select {
event_id = a.event_id,}
The text was updated successfully, but these errors were encountered:
Yes, nice example. What should source be in the final result though — from a or b?
Would we instead want to join on event_idandsource?
Hi, thanks for the reply. In final result it should work the same way it does if you rename source to anything else. If i rename source to source2 it works. It looks like something somewhere inside PRQL considers source special to have it break. It is not listed under reserved keywords though.
So when this fails:
prql target:sql.postgres
let a =(
from events_a
select {
event_id,
source,})from a
join a (==event_id)select {
event_id = a.event_id,}
This compiles just fine:
prql target:sql.postgres
let a =(
from events_a
select {
event_id,
source2,})from a
join a (==event_id)select {
event_id = a.event_id,}
into:
WITH a AS (
SELECT
event_id,
source2
FROM
events_a
)
SELECTtable_0.event_idFROM
a
JOIN a AS table_0 ONa.event_id=table_0.event_id-- Generated by PRQL compiler version:0.13.2 (https://prql-lang.org)
What happened?
When joining together two tables where both tables contain column named
source
, compile fails withAmbiguous name
error.I've tried to wrap the column name with whatever i could come up, even good old backtick does not help.
PRQL input
SQL output
Expected SQL output
No response
MVCE confirmation
Anything else?
Smallest example i could come up with is to join table with itself
The text was updated successfully, but these errors were encountered: