Re: Best way to store files inside db - Mailing list pgsql-admin

From Joshua D. Drake
Subject Re: Best way to store files inside db
Date
Msg-id 425D59B3.4000207@commandprompt.com
Whole thread Raw
In response to Best way to store files inside db  ("Chris Hoover" <revoohc@sermonaudio.com>)
List pgsql-admin
Chris Hoover wrote:
> I am looking for some help/advice.  We need to store some files inside
> postgres (at least it has been requested of us).  What is the best way
> to do this?  Right now, the files are all human readable text files, but
> that could change.

It depends on the size of the files. If the files are all reasonably
small then bytea is a fine solution. However if you are going to be
storing 5 meg PDF or some such thing I would suggest Large Objects.

> How can I do this?  I am thinking to store unmodified, I'll have to use
> a bytea field.  However, how do I tell the database to insert a file
> (say "c:\test.txt") into the table?


http://www.postgresql.org/docs/8.0/interactive/largeobjects.html

ALl the language APIs have similar functions.


Sincerely,

Joshua D. Drake



--
Your PostgreSQL solutions provider, Command Prompt, Inc.
24x7 support - 1.800.492.2240, programming, and consulting
Home of PostgreSQL Replicator, plPHP, plPerlNG and pgPHPToolkit
http://www.commandprompt.com / http://www.postgresql.org

pgsql-admin by date:

Previous
From: "Chris Hoover"
Date:
Subject: Best way to store files inside db
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Help installing 8.0.2 rpms on RH 3.0