Re: Re: postgres TODO

Поиск
Список
Период
Сортировка
От Ed Loehr
Тема Re: Re: postgres TODO
Дата
Msg-id 3969ED56.8CD45D14@austin.rr.com
обсуждение исходный текст
Ответ на Re: Re: postgres TODO  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Tom Lane wrote:
> 
> Alessio Bragadini <alessio@albourne.com> writes:
> > Peter Eisentraut wrote:
> >>>> * Add function to return primary key value on INSERT
> >>
> >> I don't get the point of this. Don't you know what you inserted? For
> >> sequences there's curval()
> 
> To get back to Peter's original question, you don't necessarily "know
> what you inserted" if you allow columns to be filled with default values
> that are calculated by complicated functions.  A serial column is just
> the simplest example of that.  Whether this situation is common enough
> to justify a special hack in INSERT is another question.  I kinda doubt
> it.  We already return the OID which is sufficient info to select the
> row again if you need it.  Returning the primary key would be
> considerably more work for no visible gain in functionality...

It's definitely not a crucial functionality gain, IMO, but it is
nonetheless a gain when you consider that *every* pgsql developer on 
the planet could then do something in one query that currently takes 
two (plus the requisite error-handling code).  A few other counter-
arguments for returning the autoincrement/serial/pkey:
1) it earns bad press w/r/t usability;2) it is an FAQ on the lists;3) it is an extremely common operation;4) other DBs
provideit;
 

Regards,
Ed Loehr


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: memory: bug or feature
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: Re: [GENERAL] PostgreSQL vs. MySQL