JOIN LATERAL (
SELECT ordinality AS ord
FROM jsonb_array_elements_text(p.variants) WITH ORDINALITY
WHERE value = v.id::text
) idx ON true
get_multiple_products.sql:99:21: column "ordinality" does not exist
the whole query worked used directly with the database
Relevant log output
get_multiple_products.sql:99:21: column "ordinality" does not exist
Database schema
JOIN LATERAL (
SELECT ordinality AS ord
FROM jsonb_array_elements_text(p.variants) WITH ORDINALITY
WHERE value = v.id::text
) idx ON true
SQL queries
SELECT
v.id AS variant_id,
v.name AS variant_name,
(
SELECT JSON_AGG(
JSON_BUILD_OBJECT(
'id', vo.id,
'value', vo.value,
'data', vo.data
)
)
FROM variant_options vo
WHERE vo.variant_id = v.id
) AS options,
idx.ord
FROM
variants v
JOIN LATERAL (
SELECT ordinality AS ord
FROM jsonb_array_elements_text(p.variants) WITH ORDINALITY
WHERE value = v.id::text
) idx ON true
WHERE
v.id = ANY(
SELECT jsonb_array_elements_text(p.variants)
)
GROUP BY
v.id, v.name, idx.ord
Version
1.26.0
What happened?
get_multiple_products.sql:99:21: column "ordinality" does not exist
the whole query worked used directly with the database
Relevant log output
Database schema
SQL queries
Configuration
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go