Error : set returning functions are not allowed in CASE, in Postgresql 10

57 Views Asked by At

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

0

There are 0 best solutions below