sql is not my strong point
upgrading from postgres 9.6 to 10.6 and I get an error from this query:
select
CASE WHEN wlh.status_reason_code like '%DR%' THEN
concat('RR',jsonb_array_elements_text(replace(wlh.status_reason_code,'DR','')::jsonb))
ELSE
''
END
from workflow.workflow_log_history wlh
error: set returning functions are not allowed in CASE
result i get back (from v 9.6):
| Concat |
|---|
| RR9 |
| RR8 |
any help please been stuck on this for a while
status_reason_code). Can you please edit your question (by clicking on the edit link below it) and add some sample input data as formatted text. See here for some tips on how to create nice looking text tables. (edit your question - do not put code or additional information in comments)jsonb_array_elements_text()returns SQL table (SETOFtext) - which is not a suitable argument forconcat(). You should probably move it to the FROM clause.