Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows

Поиск
Список
Период
Сортировка
От Abhijit Menon-Sen
Тема Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Дата
Msg-id 20121021094438.GA27309@toroid.org
обсуждение исходный текст
Ответ на Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Список pgsql-hackers
At 2012-10-17 09:56:22 -0400, tgl@sss.pgh.pa.us wrote:
>
> > Clarify that in the documentation, and also write a test case
> > that will prevent us from breaking the rule in the future.
>
> I don't believe this is a good idea in the slightest.  Yeah, the
> current implementation happens to act like that, but there is no
> reason that we should make it guaranteed behavior.

I always thought it *was* guaranteed, and I've encountered code written
by other people who were obviously under the same impression: take some
strings (e.g. flag names), use "insert … returning id", map the ids back
to the names, and use the values in further inserts into other tables
("flag_id foreign key references flags").

I know one could say "returning id, name", but there's certainly code
out there that doesn't do this.

I personally think the return order should be guaranteed; and if not,
then the documentation urgently needs some prominent warnings to tell
people that they should not assume this (for any variant of RETURNING).

-- Abhijit



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: enhanced error fields
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Successor of MD5 authentication, let's use SCRAM