Given that the
description
field is stored as a LOB, you need to use thelo_get()
function to retrieve the content referenced by the OID. However, if you want the content to be interpreted as text rather than binary, you must use PostgreSQL'sconvert_from()
function to convert it from binary (BYTEA
) to text (TEXT
), using the appropriate encoding (usuallyUTF8
).
SELECT convert_from(lo_get(public.incidence.description), 'UTF8') AS desc_data
FROM public.incidence;