Re: Adding many rows to a table. - Mailing list pgsql-sql

From Tom Lane
Subject Re: Adding many rows to a table.
Date
Msg-id 26976.958884857@sss.pgh.pa.us
Whole thread Raw
In response to Adding many rows to a table.  ("Stuart Grimshaw" <stuart@stubbynet.org.uk>)
List pgsql-sql
"Stuart Grimshaw" <stuart@stubbynet.org.uk> writes:
> The docs suggest using "copy to" for inserting lots of data. I created a
> string :

> COPY TO keywords FROM STDIN USING DELIMITERS ',';
> 520,cheese
> 520,bread
> 521,pickle
> 522,spam
> \.

> and then executed it, and got the following error

> ERROR:  parser: parse error at or near "520"

> So my question is, after all that, is that the right way to construct my
> string (regardless of language, Perl C/C++ etc)

That does work as a psql script.  In other client interfaces you might
need to submit the COPY data separately from the initial COPY command.
Hard to say more without knowing exactly what you tried with which
interface ...
        regards, tom lane


pgsql-sql by date:

Previous
From: "Stuart Grimshaw"
Date:
Subject: Adding many rows to a table.
Next
From: Peter Eisentraut
Date:
Subject: Re: Foreign keys breaks tables permissions