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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Дата
Msg-id 19445.1350482182@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  ("P. Christeas" <xrg@linux.gr>)
Ответы Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  ("P. Christeas" <xrg@linux.gr>)
Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Abhijit Menon-Sen <ams@2ndQuadrant.com>)
Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Christopher Browne <cbbrowne@gmail.com>)
Список pgsql-hackers
"P. Christeas" <xrg@linux.gr> writes:
> It has been a fact that the RETURNING clause on an INSERT will return
> multiple rows with the same order as multiple VALUES have been fed.

> eg: INSERT INTO tbl1(code) VALUES ('abc'), ('def'), ('agh')
>            RETURNING id, code;

> is expected to yield:
>    id | code
>   -----------
>     1 | abc
>     2 | def
>     3 | agh

> 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.  Nor is a regression test case going
to stop someone from changing it, anyway.
        regards, tom lane



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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows