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
{{ message }}
Repository navigation
Unable to use set returning functions in from clause with ordinality #2731
SELECT code,arr.item_object->>'code'as resource_code
FROM sys_actions,
jsonb_array_elements(resources) with ordinality arr(item_object, resource)
WHERE item_object->>'resource'=sqlc.arg('resource')
LIMIT1;
SELECTsa.codeas menu_code,record.codeas resource_code
FROM sys_actions as sa,jsonb_to_recordset(sa.resources) AS record(code VARCHAR,resource VARCHAR)
WHERErecord.resource= $1LIMIT1;
I found the same error with the next query, trying to make queries in jsonb fields:
SELECT id, y.x->>'lang'AS lang, y.x->>'name'AS gender
FROM genders g,
LATERAL (SELECT jsonb_array_elements(g.gender) AS x) AS y
WHEREg.id= $1ANDy.x->>'lang'= $2LIMIT1;
Activity
[-]column does not exist[/-][+]Unable to use set returning functions in from clause with ordinality[/+]Lay523 commentedon Sep 14, 2023
https://play.sqlc.dev/p/029d972cfbb5084f1da6c88c9c30f963cb0e1b24c4c6eaf8b76f8e909fef69d0
arturo-villalpando commentedon Sep 19, 2023
I found the same error with the next query, trying to make queries in jsonb fields:
Table alias "y" does not exist, hope to help...
kyleconroy commentedon Oct 2, 2023
Similar to #1322
test: Add case for #2731
test: Add more test cases for new analyzer (#2879)
kyleconroy commentedon Oct 24, 2023
This is fixed in v1.23.0 by enabling the database-backed query analyzer. We added a test case for this issue so it won’t break in the future.
You can play around with the working example on the playground
test: Add more test cases for new analyzer (sqlc-dev#2879)