Re: Storing Documents

From: Mitch Pirtle <mitch(dot)pirtle(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Storing Documents
Date: 2005-03-09 19:36:34
Message-ID: 330532b6050309113610febe1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hey operationsengineer1,

On Wed, 9 Mar 2005 09:39:03 -0800 (PST), operationsengineer1(at)yahoo(dot)com
<operationsengineer1(at)yahoo(dot)com> wrote:
>
> is this the best way? is there a hidden *gotcha*
> involved that i might need to be aware of?

Here is a trick I have learned over the years:

Step 1:
CREATE TABLE filebase (
id serial NOT NULL PRIMARY KEY,
filename varchar(128) NOT NULL
)

Step 2:
Have your scripts save the uploaded file as /usr/share/filebase/(id)

Step 3:
Always reference your 'filename' throughout application. That way you
don't have to worry about duplicate filenames overwriting each other
(unpleasant)... If you wanted simple version control, you could also
create a second table that stored versions for each row in the
filebase table.

-- Mitch

-- Mitch

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Kumar S 2005-03-09 21:02:06 Duplication error . please help.
Previous Message Sean Davis 2005-03-09 19:29:10 Re: VERY basic psql and schema question