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

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using psql to feed a file line by line to a table column
Date: 2013-03-12 17:10:53
Message-ID: CAADeyWjOczHjGeTxoD5jap-SE1u3OU+4eZYvZCUixaaTmp0srQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Unfortunately doesn't work -

On Tue, Mar 12, 2013 at 5:53 PM, Ian Lawrence Barwick <barwick(at)gmail(dot)com> wrote:
> 2013/3/13 Alexander Farber <alexander(dot)farber(at)gmail(dot)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 ?

Thank you
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Lawrence Barwick 2013-03-12 17:24:23 Re: Using psql to feed a file line by line to a table column
Previous Message Ian Lawrence Barwick 2013-03-12 16:53:29 Re: Using psql to feed a file line by line to a table column