Re: BUG #4684: lastval in function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4684: lastval in function
Дата
Msg-id 7406.1236014503@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #4684: lastval in function  (Chris Browne <cbbrowne@acm.org>)
Ответы Re: BUG #4684: lastval in function  (Jaime Casanova <jcasanov@systemguards.com.ec>)
Список pgsql-bugs
Chris Browne <cbbrowne@acm.org> 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 weren't going to do anything as complicated
as execute commands that might involve more than one nextval call.
If there is any remote possibility that your app might have to deal
with such a thing, you shouldn't be using lastval.

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.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Tihamer Toth-Fejel"
Дата:
Сообщение: BUG #4687: PostgreSQL website won't let me register
Следующее
От: Jaime Casanova
Дата:
Сообщение: Re: BUG #4684: lastval in function