Re: getting back autonumber just inserted

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: PFC <lists(at)boutiquenumerique(dot)com>
Cc: lmeadors(at)apache(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: getting back autonumber just inserted
Date: 2005-07-08 03:28:39
Message-ID: 20050708032839.GA53708@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Jul 08, 2005 at 05:03:37AM +0200, PFC wrote:
> >On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote:
> >>Hm, interesting, you mean the return value of lastval() also depends
> >>if you set your constraints to deferred or immediate ?
> >
> >My mind's ablank trying to contrive a situation where that would
> >matter. Can you provide an example?
>
> It's rather perverse and farfetched, but what would stop one from
> putting some insert statements in a function that happens to be called
> somewhere inside of a check constraint... although one could agree that
> it's a bit shooting oneself in the foot...

PostgreSQL doesn't support deferral of check constraints, only
foreign key constraints. But yeah, if you could do that then
presumably lastval() might return a different sequence's value
depending on whether the constraints were deferred or immediate.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Browne 2005-07-08 03:39:21 Re: Make COUNT(*) Faster?
Previous Message PFC 2005-07-08 03:03:37 Re: getting back autonumber just inserted