Re: Exporting a PDF from a bytea column - Mailing list pgsql-general

From John R Pierce
Subject Re: Exporting a PDF from a bytea column
Date
Msg-id 56C67BDA.6060800@hogranch.com
Whole thread Raw
In response to Exporting a PDF from a bytea column  (CS DBA <cs_dba@consistentstate.com>)
Responses Re: Exporting a PDF from a bytea column  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On 2/18/2016 4:44 PM, CS DBA wrote:
> The system stores PDF's as large objects
> in bytea columns.

Large Objects aka LO's and bytea columns are two completely different
things.

bytea columns are regular SQL database columns that contain a binary
byte array.    large objects (LO) are a whole separate facility, where
each object is referenced by a unique OID, and the object is read and
written with the lo_XXX() functions in libpq, or equivalents in other
language specific bindings.
http://www.postgresql.org/docs/current/static/largeobjects.html

in a C program, an LO can be exported to a file via the API lo_export()
http://www.postgresql.org/docs/current/static/lo-interfaces.html#LO-EXPORT


> Can anyone send me an example of
> exporting from a bytea column to a PDF file?

I don't think you can get from a bytea field to a file without some
coding, as SQL scripting doesn't handle binary blobs very well.

--
john r pierce, recycling bits in santa cruz



pgsql-general by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Live steraming replication setup issue!
Next
From: "David G. Johnston"
Date:
Subject: Re: Exporting a PDF from a bytea column