Re: How to store text files in the postgresql?

Поиск
Список
Период
Сортировка
От DimitryASuplatov
Тема Re: How to store text files in the postgresql?
Дата
Msg-id 1244295440.8823.26.camel@leiden.genebee.msu.ru
обсуждение исходный текст
Ответ на How to store text files in the postgresql?  (DimitryASuplatov <genesup@gmail.com>)
Список 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




В списке pgsql-general по дате отправления:

Предыдущее
От: "Leif B. Kristensen"
Дата:
Сообщение: Re: limit table to one row
Следующее
От: Martin Gainty
Дата:
Сообщение: Re: PostgreSQL and XA Distributed Transaction Protocol