From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Cc: | Kris Jurka <books(at)ejurka(dot)com>, Andrei Ilitchev <andrei(dot)ilitchev(at)oracle(dot)com>, Marina Vatkina <Marina(dot)Vatkina(at)sun(dot)com> |
Subject: | Re: Fw: postgresql experts please help |
Date: | 2007-10-18 19:57:37 |
Message-ID: | 200710181257.37449.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2007-10-18 20:05:42 | Re: Fw: postgresql experts please help |
Previous Message | Kris Jurka | 2007-10-18 19:09:39 | Re: Fw: postgresql experts please help |