Currently, i have a number of files stored in postgres 8.4 as bytea. The file types are .doc, .odt, .pdf, .txt and etc.
May i know how to download all the file store
DO $$ DECLARE l_lob_id OID; r record; BEGIN for r in select data, filename from bytea_table LOOP l_lob_id:=lo_from_bytea(0,r.data); PERFORM lo_export(l_lob_id,'/home/...'||r.filename); PERFORM lo_unlink(l_lob_id); END LOOP; END; $$