INSERT RETURNING

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: goel922(at)gmail(dot)com
Subject: INSERT RETURNING
Date: 2022-08-28 13:33:34
Message-ID: 166169361401.1235914.14603431623892379252@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/dml-returning.html
Description:

If I execute the below query
```
CREATE TABLE users (
id serial primary key,
name varchar(255)
)
INSERT INTO users (name) VALUES ('a'), ('b'), ('c') RETURNING id
```
Is there any chance that the order of the returned ids is different from the
order of data passed
To be more clear, if the returned ids are `1, 2, 3`, is it guaranteed that
the data order is ((1, a), (2, b), (3, c)) or can it be ((1, b), (2, a), (3,
c))?

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2022-08-28 14:45:49 Re: Handling of quantity in recursive query example
Previous Message Simon Riggs 2022-08-28 11:43:22 Re: Handling of quantity in recursive query example