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

Поиск
Список
Период
Сортировка
"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