From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jason Ayre <jasonayre(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: 12.4 -> 12.5 upgrade, broken CTE query |
Date: | 2021-03-10 21:51:31 |
Message-ID: | 2218080.1615413091@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Jason Ayre <jasonayre(at)gmail(dot)com> writes:
> RDS Auto updated my instanced from 12.4 to 12.5 last night, and the
> following query (and several others like it) which were previously working
> throws a "set-returning functions must appear at the top level of FROM" -
> ERROR: set-returning functions must appear at top level of FROM
> LINE 2: FROM surveys, uuid(jsonb_array_elements_tex...
That restriction's been there since v10, so I'm having a hard time
believing that this query worked in 12.4.
It looks to me like the easiest way to get around it is just to put
the uuid() call in the SELECT output list:
WITH "questions_order" AS (
SELECT uuid(question_id) AS question_id, sort_position
FROM surveys,
jsonb_array_elements_text(surveys.custom_fields->'questions_order')
WITH ORDINALITY AS f(question_id, sort_position)
...
In other cases it might be best to stick the extra function into
an additional layer of lateral function, like
FROM surveys,
jsonb_array_elements_text(surveys.custom_fields->'questions_order')
WITH ORDINALITY AS f(question_id, sort_position),
uuid(f.question_id) AS whatever
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-03-10 22:00:08 | Re: BUG #16919: Unexpected precision loss in NUMERIC type during text cast, math operations |
Previous Message | Jason Ayre | 2021-03-10 21:04:21 | 12.4 -> 12.5 upgrade, broken CTE query |