Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 24478475BA0 for ; Fri, 5 Jul 2002 08:28:06 -0400 (EDT) Mailbox-Line: From sschildknecht@aurora-linux.com Fri Jul 5 08:28:06 2002 Received: from mailhost.aurora-linux.com (mailhost.aurora-linux.com [62.23.197.104]) by postgresql.org (Postfix) with ESMTP id 8FCAB475A4E for ; Fri, 5 Jul 2002 08:28:04 -0400 (EDT) Received: from arrow.aurora-linux.com (ls.aurora-linux.com [62.23.197.102]) by mailhost.aurora-linux.com (Postfix) with ESMTP id AA71D91667; Fri, 5 Jul 2002 14:28:07 +0200 (CEST) Received: by arrow.aurora-linux.com (Postfix, from userid 1) id 450EC3EE12; Fri, 5 Jul 2002 14:28:05 +0200 (CEST) Received: from fukse.aurora-linux.net (fukse.aurora-linux.net [192.168.10.121]) by arrow.aurora-linux.com (Postfix) with ESMTP id 2EFC22F3A2; Fri, 5 Jul 2002 14:28:04 +0200 (CEST) Subject: Re: how to use nextval() From: Stephane Schildknecht To: juerg.rietmann@pup.ch Cc: pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable X-Mailer: Ximian Evolution 1.0.8 Date: 05 Jul 2002 14:28:21 +0200 Message-Id: <1025872101.10925.289.camel@fukse> Mime-Version: 1.0 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Spam-Status: No, hits=-3.4 required=5.0 tests=IN_REP_TO version=2.30 X-Spam-Level: X-Archive-Number: 200207/59 X-Sequence-Number: 8438 Le ven 05/07/2002 =E0 14:03, juerg.rietmann@pup.ch a =E9crit : > Hello there >=20 > I have an idea how to solve my problem on copy a record to a new one in t= he > same table. To do so I need the next value for the primary key. >=20 > Using : >=20 > select nextval('pk_auftrag') as nextkey from auftrag; >=20 > I get an error like : Relation pk_auftrag does not exist ! >=20 > Thanks for any help ... jr Try to get the right name of the sequence. By default, something like auftrag_auftrag_id_seq, if auftrag_id is the serial primary key. select nextval('auftrag_auftrag_id_seq') as nextkey; S@S