Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8CFB7475B86 for ; Tue, 20 Aug 2002 08:01:50 -0400 (EDT) Received: from bast.unixathome.org (bast.unixathome.org [216.187.105.150]) by postgresql.org (Postfix) with ESMTP id EB94C475AF9 for ; Tue, 20 Aug 2002 08:01:49 -0400 (EDT) Received: from wocker (wocker.unixathome.org [192.168.0.99]) by bast.unixathome.org (Postfix) with ESMTP id 4C0233F3A; Tue, 20 Aug 2002 08:01:52 -0400 (EDT) From: "Dan Langille" To: "Aaron Held" Date: Tue, 20 Aug 2002 08:00:28 -0400 MIME-Version: 1.0 Subject: Re: bulk imports with sequence Cc: Message-ID: <3D61F71C.23211.5F25BAFB@localhost> In-reply-to: <000b01c24840$7b5a0880$4b00a8c0@metrony.com> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/290 X-Sequence-Number: 9136 On 20 Aug 2002 at 7:55, Aaron Held wrote: > I am importing a large number of records monthly using the \copy (from > text file)command. > > I would like to use a sequence as a unique row ID for display in my > app. > > Is there any way to let postgresql generate the sequence itself. > Currently the only way I can make it work is to grab the next seq > value and insert my own numbers into the file Yes: create sequence mytable_id_seq; alter table mytable alter column id set default nextval('mycolumn_id_seq'::text); -- Dan Langille I'm looking for a computer job: http://www.freebsddiary.org/dan_langille.php