Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id E60464768FA for ; Fri, 5 Jul 2002 08:41:19 -0400 (EDT) Mailbox-Line: From achill@matrix.gatewaynet.com Fri Jul 5 08:41:19 2002 Received: from matrix.gatewaynet.com (unknown [217.19.69.50]) by postgresql.org (Postfix) with ESMTP id 26A914759B1 for ; Fri, 5 Jul 2002 08:38:50 -0400 (EDT) Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.11.6/8.11.6) with ESMTP id g65CbNR17432; Fri, 5 Jul 2002 15:37:23 +0300 Date: Fri, 5 Jul 2002 15:37:22 +0300 (EEST) From: Achilleus Mantzios To: juerg.rietmann@pup.ch Cc: pgsql-sql@postgresql.org Subject: Re: how to use nextval() In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-3.5 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT,NO_MX_FOR_FROM version=2.30 X-Spam-Level: X-Archive-Number: 200207/60 X-Sequence-Number: 8439 On Fri, 5 Jul 2002 juerg.rietmann@pup.ch wrote: > Hello there > > I have an idea how to solve my problem on copy a record to a new one in the > same table. To do so I need the next value for the primary key. > > Using : > > select nextval('pk_auftrag') as nextkey from auftrag; > > I get an error like : Relation pk_auftrag does not exist ! Do a \d to find out the name of your sequence. Most probably it will be named as "auftrag__seq". Let it be "auftrag_id_seq". Your command is SELECT nextval('"auftrag_id_seq"'::text); > > Thanks for any help ... jr > > __________________________________________________ > > PFISTER + PARTNER, SYSTEM - ENGINEERING AG > Juerg Rietmann > Grundstrasse 22a > 6343 Rotkreuz > Switzerland > > internet : www.pup.ch > phone : +4141 790 4040 > fax : +4141 790 2545 > mobile : +4179 211 0315 > __________________________________________________ > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > -- Achilleus Mantzios S/W Engineer IT dept Dynacom Tankers Mngmt tel: +30-10-8981112 fax: +30-10-8981877 email: achill@matrix.gatewaynet.com mantzios@softlab.ece.ntua.gr