What happened?
- Doing an
append in postgres with null columns on one side.
prqlc outputs a query that leads to runtime failure UNION types integer and text cannot be matched.
PRQL input
prql target:sql.postgres
from invoices | select { an_id = invoice_id, a_date = null } | take 2
append (from employees | select { an_id = null, a_date = birth_date } | take 2)
SQL output
WITH table_0 AS (
SELECT
NULL AS an_id,
birth_date AS a_date
FROM
employees
LIMIT
2
)
SELECT
*
FROM
(
SELECT
invoice_id AS an_id,
NULL AS a_date
FROM
invoices
LIMIT
2
) AS table_1
UNION
ALL
SELECT
*
FROM
table_0
Expected SQL output
(
SELECT
invoice_id AS some_id,
NULL AS some_date
FROM
invoices
LIMIT
2
)
UNION
ALL (
SELECT
NULL AS some_id,
birth_date AS some_date
FROM
employees
LIMIT
2
)
MVCE confirmation
Anything else?
The SQL output works in the PRQL playground.
It seems some engines struggle to infer types with those SELECT * FROM in the way.
What happened?
appendinpostgreswithnullcolumns on one side.prqlcoutputs a query that leads to runtime failureUNION types integer and text cannot be matched.PRQL input
SQL output
Expected SQL output
MVCE confirmation
Anything else?
The SQL output works in the PRQL playground.
It seems some engines struggle to infer types with those
SELECT * FROMin the way.