Re: how to use nextval()

From: Stephane Schildknecht <sschildknecht(at)aurora-linux(dot)com>
To: juerg(dot)rietmann(at)pup(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to use nextval()
Date: 2002-07-05 12:28:21
Message-ID: 1025872101.10925.289.camel@fukse
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Le ven 05/07/2002 à 14:03, juerg(dot)rietmann(at)pup(dot)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(at)S

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2002-07-05 12:37:22 Re: how to use nextval()
Previous Message Chantal Ackermann 2002-07-05 12:08:42 Re: Selecting data from a table created in another database...