Re: Storing Documents - Mailing list pgsql-novice

From Mitch Pirtle
Subject Re: Storing Documents
Date
Msg-id 330532b6050309113610febe1f@mail.gmail.com
Whole thread Raw
In response to Storing Documents  (<operationsengineer1@yahoo.com>)
List pgsql-novice
Hey operationsengineer1,

On Wed, 9 Mar 2005 09:39:03 -0800 (PST), operationsengineer1@yahoo.com
<operationsengineer1@yahoo.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

pgsql-novice by date:

Previous
From: Sean Davis
Date:
Subject: Re: VERY basic psql and schema question
Next
From: Kumar S
Date:
Subject: Duplication error . please help.