From: Josh Berkus <josh@agliodbs.com>
To: pgsql-jdbc@postgresql.org
Cc: Kris Jurka <books@ejurka.com>
Cc: Andrei Ilitchev <andrei.ilitchev@oracle.com>
Cc: Marina Vatkina <Marina.Vatkina@sun.com>
Subject: Re: Fw: postgresql experts please help
Date: Thu, 18 Oct 2007 12:57:37 -0700
Message-ID: <200710181257.37449.josh@agliodbs.com> (raw)
In-Reply-To: <Pine.BSO.4.64.0710181506040.30980@leary.csoft.net>
References: <001101c81189$2f3f52d0$4c349c0a@ca.oracle.com>
<00d601c811b7$47c1a6e0$4c349c0a@ca.oracle.com>
<Pine.BSO.4.64.0710181506040.30980@leary.csoft.net>
Kris,
> If you have an after trigger on the table that you're inserting into and
> it inserts into another table with a serial column, the lastval call will
> use the wrong sequence. Now this is also a problem with currval if you
> have a trigger that inserts into the same table, but that's an unlikely
> application design. Inserting into another table is something that you'll
> find with systems that do auditing or sometimes horizontal partitioning of
> a table.
I'm pretty sure there's a version of lastval() which takes the table name as a
parameter. That would be the safer one to use.
--
Josh Berkus
PostgreSQL @ Sun
San Francisco
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: josh@agliodbs.com, books@ejurka.com, andrei.ilitchev@oracle.com, Marina.Vatkina@sun.com
Subject: Re: Fw: postgresql experts please help
In-Reply-To: <200710181257.37449.josh@agliodbs.com>
References: <001101c81189$2f3f52d0$4c349c0a@ca.oracle.com> <00d601c811b7$47c1a6e0$4c349c0a@ca.oracle.com> <Pine.BSO.4.64.0710181506040.30980@leary.csoft.net> <200710181257.37449.josh@agliodbs.com>
* 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