Re: lastval()

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Abhijit Menon-Sen <ams(at)oryx(dot)com>, db(at)zigo(dot)dhs(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: lastval()
Date: 2005-06-06 04:57:02
Message-ID: 42A3D79E.4030001@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> This definition is OK with me ... so long as it still includes the
> phrase "an error occurs if no nextval or setval has occurred in the
> current session". However it seemed that a number of people asking
> for the feature wanted some-random-default to be returned instead.

Right -- I think it definitely needs to return an error in that
situation. Per my earlier mail, the other debatable behavior is whether
lastval() should be defined if the sequence it would be returning the
currval() for has been subsequently dropped. I'm inclined to not return
an error here to simplify the implementation, but I'm open to objections.

> Another question is why should setval affect the result? I don't
> see the use-case for that offhand.

I'm not militant about it, but having setval() affect the result means
lastval() is more consistent with currval().

-Neil

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-06 05:05:55 Re: lastval()
Previous Message Tom Lane 2005-06-06 04:20:44 Re: lastval()

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-06-06 05:05:55 Re: lastval()
Previous Message Tom Lane 2005-06-06 04:20:44 Re: lastval()