Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Date
Msg-id 23488.1350841154@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Er, what?

>     with orig_inserts as
>     (
>          insert into table_1
>          ...
>          returning *
>     ),
>     ordered_inserts as
>     (
>          select * from orig_inserts
>          order by ...
>     )
>     insert into table_2
>     select * from ordered_inserts ...;

I'm not exactly following what that proves?  It seems like this is still
making a not-guaranteed assumption, which is that the outer INSERT isn't
going to choose to rearrange the order of the rows coming from the CTE.
Strictly speaking, even "SELECT * FROM ordered_inserts" isn't promising
anything about row order.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows
Next
From: Andrew Dunstan
Date:
Subject: Re: Re: [PATCH] Enforce that INSERT...RETURNING preserves the order of multi rows