Re: BUG #4684: lastval in function - Mailing list pgsql-bugs

From Andreas
Subject Re: BUG #4684: lastval in function
Date
Msg-id gogrdq$1uvg$1@news.hub.org
Whole thread Raw
In response to Re: BUG #4684: lastval in function  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-bugs
Heikki Linnakangas schrieb:
> andreas wrote:
>> if nextval is used inside a function in a insertstatement, you get always
>> the value from inside the last function. but i expected, that lastval()
>> deliver the value from the insertstatement. i think, this should
>> clearify in
>> the documentation, or better fixed that the nextval from an
>> insertstatement
>> is called after the functioncalls.
>
> Well, others might expect the opposite, like existing applications. Want
> to suggest wording for the documentation?

Yes, existing applications might be involved. But i think, this is a
very rare situation. But if someone use an insertstatement with a
functioncall, but the function do NOT use nextval, and he use lastval to
estimate the last inserted value he has no problems. But if then someone
change the function so the function use nextval then the application
crashes. So i think it is much more better to change the behavior,
because this is what i expect. And i think, this is what others
expect too.

Andreas

pgsql-bugs by date:

Previous
From: "Jonas R. Pacheco"
Date:
Subject: BUG #4686: There is not enough memory to complete this operation
Next
From: Chris Browne
Date:
Subject: Re: BUG #4684: lastval in function