Re: Sequence

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequence
Date: 2008-07-25 05:19:51
Message-ID: 20080725051951.GA24432@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Fri, dem 25.07.2008, um 15:54:23 +1100 mailte Alex Cheshev folgendes:
> Hello.
> A table has two primary keys: CREATE TABLE example ( pk1 integer, pk2
> integer, PRIMARY KEY (pk1, pk2) ). To add a new record I use command:
> INSERT INTO example (pk1, pk2) VALUES (0, 0). Before adding the new
> record I have to find out the last value of pk2. How can I use something
> like this: INSERT INTO example (pk1, pk2) VALUES (0, nextval('pk2'))?
> If a table just has one primary key I can use sequence (CREATE
> SEQUENCE). What about two primary keys?

You can also use a sequence.

Regards, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

  • Sequence at 2008-07-25 04:54:23 from Alex Cheshev

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2008-07-25 05:45:20 Re: Sequence
Previous Message Alex Cheshev 2008-07-25 04:54:23 Sequence