pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephane Schildknecht <sschildknecht@aurora-linux.com>
To: juerg.rietmann@pup.ch
Cc: pgsql-sql@postgresql.org
Subject: Re: how to use nextval()
Date: 05 Jul 2002 14:28:21 +0200
Message-ID: <1025872101.10925.289.camel@fukse> (raw)
In-Reply-To: <OF5CD8DD5B.CD18AF26-ONC1256BED.0041BE98-C1256BED.00422F9C@pup.ch>
References: <OF5CD8DD5B.CD18AF26-ONC1256BED.0041BE98-C1256BED.00422F9C@pup.ch>

Le ven 05/07/2002 à 14:03, juerg.rietmann@pup.ch a écrit :
> 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 !
> 
> 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






view thread (3+ messages)  latest in thread

Message-ID: <1025872101.10925.289.camel@fukse>
Permalink:  ../1025872101.10925.289.camel@fukse/
Also on:    postgresql.org/message-id/1025872101.10925.289.camel@fukse

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sschildknecht@aurora-linux.com, juerg.rietmann@pup.ch
  Subject: Re: how to use nextval()
  In-Reply-To: <1025872101.10925.289.camel@fukse>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox