Re: Insert Documentation - Returning Clause and Order

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, ashutosh(dot)bapat(at)enterprisedb(dot)com
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Insert Documentation - Returning Clause and Order
Date: 2020-12-11 13:24:45
Message-ID: CAExHW5tAZPT9hZ0neepAroSY71wGsTL+2OamKTp0M8RMZ4u=zA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 10, 2020 at 7:49 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Thursday, December 10, 2020, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>>
>> On Wed, Dec 9, 2020 at 9:10 PM David G. Johnston
>> <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>> >
>> > Hey,
>> >
>> > Would it be accurate to add the following sentence to the INSERT documentation under "Outputs"?
>> >
>> > "...inserted or updated by the command." For a multiple-values insertion, the order of output rows will match the order that rows are presented in the values or query clause.
>>
>> Postgres's current implementation may be doing so, but I don't think
>> that can be guaranteed in possible implementations. I don't think
>> restricting choice of implementation to guarantee that is a good idea
>> either.
>>
>
> Yeah, the ongoing work on parallel inserts would seem to be an issue. We should probably document that though. And maybe as part of parallel inserts patch provide a user-specifiable way to ask for such a guarantee if needed. ‘Insert returning ordered”

I am curious about the usecase which needs that guarantee? Don't you
have a column on which you can ORDER BY so that it returns the same
order as INSERT?

--
Best Wishes,
Ashutosh Bapat

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2020-12-11 13:26:56 Re: Feature Proposal: Add ssltermination parameter for SNI-based LoadBalancing
Previous Message Dean Rasheed 2020-12-11 12:58:36 Re: PoC/WIP: Extended statistics on expressions