Re: trigger that needs a PK

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: trigger that needs a PK
Date: 2008-02-13 08:35:27
Message-ID: 20080213083527.GF24109@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

am Tue, dem 12.02.2008, um 23:46:41 -0800 mailte johnf folgendes:
> > http://www.postgresql.org/docs/current/static/functions-sequence.html
> >
> >
> > HTH, Andreas
>
> But how do I do automaticly???
>
> You code implies that I just string two inserts together. I was hoping to use
> rules or some other way to do it automaticly.

currval() returns the last inserted value within the current session, it
is the usual way to insert into the parent table and use currval() to
obtain the last inserted serial value for inserts into the child table.

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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message johnf 2008-02-13 15:11:51 Re: trigger that needs a PK
Previous Message johnf 2008-02-13 07:46:41 Re: trigger that needs a PK