pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric McKeeth <eldin00@gmail.com>
To: emilu@encs.concordia.ca
Cc: pgsql-sql@postgresql.org
Subject: Re: column type for pdf file
Date: Wed, 18 May 2011 17:06:36 -0600
Message-ID: <BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com> (raw)
In-Reply-To: <4DD42A1C.30202@encs.concordia.ca>
References: <4DD42A1C.30202@encs.concordia.ca>

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

view thread (14+ messages)  latest in thread

Message-ID: <BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com>
Permalink:  ../BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com/
Also on:    postgresql.org/message-id/BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: eldin00@gmail.com, emilu@encs.concordia.ca
  Subject: Re: column type for pdf file
  In-Reply-To: <BANLkTimpYJk2=D8TUFDjWRQLmQNfRa_d=Q@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox