prql icon indicating copy to clipboard operation
prql copied to clipboard

Wrong output when tables are used and columns have same name

Open cottrell opened this issue 1 year ago • 10 comments
trafficstars

What happened?

Deriving columns with same name as existing results in confusing or wrong output.

image image

PRQL input

from invoices
derive {
  total = invoices.total * 0,
  a = invoices.total * 0,
}
into data

from data
select {
total,
data.total,
a
}

SQL output

WITH data AS (
  SELECT
    *,
    total * 0 AS total,
    total * 0 AS a
  FROM
    invoices
)
SELECT
  total,
  total,
  a
FROM
  data

-- Generated by PRQL compiler version:0.12.2 (https://prql-lang.org)

Expected SQL output

No response

MVCE confirmation

  • [X] Minimal example
  • [X] New issue

Anything else?

No response

cottrell avatar Jul 17 '24 19:07 cottrell