Re: Copy and serial type problem

From: missive(at)frontiernet(dot)net (Lee Harr)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Copy and serial type problem
Date: 2001-07-22 22:57:43
Message-ID: 9jflp7$ph6$1@node21.cwnet.roc.gblx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 22 Jul 2001 21:13:26 +0200, <morphik(at)irc(dot)nospam(dot)gdansk(dot)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".

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2001-07-23 00:23:51 Re: psql on red hat 7.1
Previous Message Tom Lane 2001-07-22 22:52:39 Re: Planner estimates cost of 'like' a lot lower than '='??