Re: Using psql to feed a file line by line to a table column

Поиск
Список
Период
Сортировка
От Ian Lawrence Barwick
Тема Re: Using psql to feed a file line by line to a table column
Дата
Msg-id CAB8KJ=gk3OrNzo7zrwCjPPA+hwkzECx8wtJwXmOmvfJX2bH8DA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using psql to feed a file line by line to a table column  (Alexander Farber <alexander.farber@gmail.com>)
Ответы Re: Using psql to feed a file line by line to a table column
Список pgsql-general
2013/3/13 Alexander Farber <alexander.farber@gmail.com>:
> Unfortunately doesn't work -
>
> On Tue, Mar 12, 2013 at 5:53 PM, Ian Lawrence Barwick <barwick@gmail.com> wrote:
>> 2013/3/13 Alexander Farber <alexander.farber@gmail.com>:
>>>
>>> I have a list of 400000 non-english words,
>>> each on a separate line and in UTF8 format,
>>> which I'd like to put in the "word" column
>>> of the following table (also in UTF8 and 8.4.13):
>>>
>>> create table good_words (
>>>         word varchar(64) primary key,
>>>         verified boolean not null default false,
>>>         stamp timestamp default current_timestamp
>>> );
>>>
>
>>
>> This should work from psql:
>>
>> \copy good_words(word) from '/path/to/file.txt'
>
> I try:
>
> bukvy=> \copy bukvy_good_words(word) from WORDS ;
> \copy: parse error at ";"
> bukvy=> \copy bukvy_good_words(word) from 'WORDS' ;
> \copy: parse error at ";"
> bukvy=> \copy bukvy_good_words(word) from "WORDS" ;
> \copy: parse error at ";"
> bukvy=> \copy bukvy_good_words(word) from '/home/afarber/WORDS' ;
> \copy: parse error at ";"
> bukvy=> \copy bukvy_good_words(word) from "/home/afarber/WORDS" ;
> \copy: parse error at ";"
>
> (sorry, lied you about the table name :-)
>
> The file is in the home dir and readable:
>
> # ls -al WORDS
> -rw-rw-r-- 1 afarber afarber 8263539 Mar 12  2013 WORDS
>
> Any ideas, what is wrong there for 8.4.13 ?

Yup:

  \copy: parse error at ";"

which is psql telling you it doesn't like the semicolon. Try
leaving it out...


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

Предыдущее
От: Alexander Farber
Дата:
Сообщение: Re: Using psql to feed a file line by line to a table column
Следующее
От: "Emre Hasegeli"
Дата:
Сообщение: Re: PostgreSQL 9.2.3 performance problem caused Exclusive locks