Re: column type for pdf file - Mailing list pgsql-sql

From Eric McKeeth
Subject Re: column type for pdf file
Date
Msg-id BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com
Whole thread Raw
In response to column type for pdf file  (Emi Lu <emilu@encs.concordia.ca>)
Responses Re: column type for pdf file
List pgsql-sql
On Wed, May 18, 2011 at 2:20 PM, Emi Lu <emilu@encs.concordia.ca> wrote:
Hello,

To save pdf files into postgresql8.3, what is the best column type?

bytea, blob, etc?

Thank you,
Emi

Everyone else has pointed out reasons for not doing this, and I agree with them that in the large majority of cases just storing a reference to a file stored outside the database is preferable. However, to answer the question you asked, my rule of thumb is that if you need to store binary data in the database is to use a bytea column, unless you need the random access capabilities that the large object interface provides. A bytea column is typically easier to use, and has proper transactional behavior, enforcement of referential integrity, etc.

-Eric

pgsql-sql by date:

Previous
From: "Ozer, Pam"
Date:
Subject: Re: Sorting Issue
Next
From: David W Noon
Date:
Subject: Re: foreign keys and lots of tables