I'm new to PostgreSQL, and I have the following code
select unnest(xpath(
'//ns2:ProcedureCategory/text()',messagebody::xml,
array[array['ns2','urn:wco:datamodel:WCO:DEC-DMS:2']]
))::text
from sw_customs_message scm
where unnest(xpath(
'//ns2:ProcedureCategory/text()',messagebody::xml,
array[array['ns2','urn:wco:datamodel:WCO:DEC-DMS:2']]
))::text = 'H7'
and I get the error message
SQL Error [0A000]: ERROR: set-returning functions are not allowed in WHERE Position: 172