Re: How to store text files in the postgresql?

From: DimitryASuplatov <genesup(at)gmail(dot)com>
To: rod(at)iol(dot)ie, pgsql-general(at)postgresql(dot)org
Subject: Re: How to store text files in the postgresql?
Date: 2009-06-06 13:37:20
Message-ID: 1244295440.8823.26.camel@leiden.genebee.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you for answering.

I`ve read a manual and now I have a more advanced question.

1/ I`ve created a table in the database

mypdb=# create table pdb(
index int,
filename text,
filecontent text
);

2/ Then I want to read a file into it

First I insert metainfo

mypdb=# insert into pdb (index , filename) values (1,
'/home/sda/Documents/Work/PVA_India/PGA_test_modeling/pdb/1gm9.pdb');
INSERT 0 1

But then comes the problem because the only command I found to read in
the file content is COPY but the following command would not work

mypdb=# copy pdb (filecontent) from
'/home/sda/Documents/Work/PVA_India/PGA_test_modeling/pdb/1gm9.pdb'
where index=1;
ERROR: syntax error at or near "where"
LINE 1: ...ts/Work/PVA_India/PGA_test_modeling/pdb/1gm9.pdb' where
inde...

QUESTION: what is the command to read the content of a plain text file
into a SPECIFIED table entry?

Thank you for your time.
SDA

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moseley 2009-06-06 14:03:56 Select last week
Previous Message Raymond O'Donnell 2009-06-06 12:25:49 Re: How to store text files in the postgresql?