Re: [BUGS] BUG #4684: lastval in function

2009-03-02 Thread Jaime Casanova
On Mon, Mar 2, 2009 at 12:21 PM, Tom Lane wrote: > > Before considering complicating the definition of lastval, I'd vote > for removing it entirely.  It's a foot-gun and will never be anything > but. > +1 -- Atentamente, Jaime Casanova Soporte y capacitación de PostgreSQL Asesoría y desarrollo

Re: [BUGS] BUG #4684: lastval in function

2009-03-02 Thread Tom Lane
Chris Browne writes: > I'm not sure I'd *want* to have a more-sophisticated scoping mechanism > for this. We already have an appropriate language-level solution for this: it's called INSERT RETURNING. The fact is that lastval was invented to aid in porting brain-dead mysql applications that were

Re: [BUGS] BUG #4684: lastval in function

2009-03-02 Thread Chris Browne
Andreas writes: > 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 >>> clearif

Re: [BUGS] BUG #4684: lastval in function

2009-03-02 Thread Andreas
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

Re: [BUGS] BUG #4684: lastval in function

2009-03-02 Thread Heikki Linnakangas
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

Re: [BUGS] BUG #4684: lastval in function

2009-02-28 Thread Tom Lane
"andreas" writes: > select lastval() ; > lastval > - >2 > i expected lastval() should be 1, because this is the id from the > insertstatement. Well, you can't really rely on that when the statement you're executing contains two different nextval() calls, as this does. The order

[BUGS] BUG #4684: lastval in function

2009-02-28 Thread andreas
The following bug has been logged online: Bug reference: 4684 Logged by: andreas Email address: postgre...@elbrief.de PostgreSQL version: 8.3.6 Operating system: linux Description:lastval in function Details: create table bla ( id serial primary key , name text not