Thread: Re: Copy and serial type problem

Re: Copy and serial type problem

From
missive@frontiernet.net (Lee Harr)
Date:
On Sun, 22 Jul 2001 21:13:26 +0200, <morphik@irc.nospam.gdansk.pl>:
> Hi,
>
> I've created a small table:
>
> CREATE TABLE "table" (
>   "id" int4 DEFAULT nextval('"table_idd_seq"') NOT NULL,
>   "file" character varying(40) NOT NULL
> );
>
> Table sequence 'table_idd_seq' is also available with a next id number.
>
> Question is how to use postgres copy function with this 'id'. Table 'table'
> is not empty... I've tried to insert nextval("table_idd_seq") into file but
> it doesn't work.
>


Not sure how you can do this in one step, but you can create a
temporary table to hold the "file" data and copy in to that,
then INSERT ... SELECT that data in to "table".