| От | CoL |
|---|---|
| Тема | Re: Loading text files into a text attribute |
| Дата | |
| Msg-id | c4jeub$2e7j$1@news.hub.org обсуждение исходный текст |
| Ответ на | Loading text files into a text attribute ("BARTKO, Zoltan" <bartko.zoltan@pobox.sk>) |
| Список | pgsql-general |
hi,
BARTKO, Zoltan wrote:
> Hello folks,
>
> I have the following problem:
>
> I have a bunch of text files, I want to load them into a table where each
> file will be stored in one row.
>
> Question 1: Is there any way how to do this in psql?
>
> AFAIK the \copy command interprets \n as a new line and so I can't get it
> done what I want. So I wrote a C program that parses my text files and
> anywhere it sees a \n it puts \\n and then concatenates the files, etc. -
> quite complicated.
>
> Question 2: Is there a simpler way of doing this?
you can make a plperlu, untrested perl function, which reads the entire
file, than:
insert into table (text) values (plperufunction('/path/to/file'));
C.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера