Skip site navigation (1) Skip section navigation (2)

Re: BUG #4684: lastval in function

From: Andreas <postgresql(at)elbrief(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4684: lastval in function
Date: 2009-03-02 14:45:14
Message-ID: gogrdq$1uvg$ (view raw, whole thread or download thread mbox)
Lists: 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.


In response to


pgsql-bugs by date

Next:From: Chris BrowneDate: 2009-03-02 16:49:03
Subject: Re: BUG #4684: lastval in function
Previous:From: Jonas R. PachecoDate: 2009-03-02 13:14:43
Subject: BUG #4686: There is not enough memory to complete this operation

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group