ts-safeql / safeql

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.
https://safeql.dev
MIT License
1.35k stars 22 forks source link

Support `to_json()` function #237

Open ravshansbox opened 5 months ago

ravshansbox commented 5 months ago

Describe the bug Properly identify to_json()/to_jsonb() function output type

To Reproduce

select t1.*, to_json(t2.*) as col2 from table1 t1
join table2 t2 on t2.id = t1.table2_ref_id;

Expected behavior This query selects all columns from table1 and joins all columns from table2 as col2. But safeql is identifying col2 as unknown rather that all columns of table2.

Desktop (please complete the following information):