Re: trigger that needs a PK - Mailing list pgsql-novice

From A. Kretschmer
Subject Re: trigger that needs a PK
Date
Msg-id 20080213083527.GF24109@a-kretschmer.de
Whole thread Raw
In response to Re: trigger that needs a PK  (johnf <jfabiani@yolo.com>)
Responses Re: trigger that needs a PK  (johnf <jfabiani@yolo.com>)
List 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

pgsql-novice by date:

Previous
From: johnf
Date:
Subject: Re: trigger that needs a PK
Next
From: johnf
Date:
Subject: Re: trigger that needs a PK