pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
INSERT ... RETURNING documentation
3+ messages / 3 participants
[nested] [flat]

* INSERT ... RETURNING documentation
@ 2024-07-25 20:35  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2024-07-25 20:35 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: masondeanm@aol.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/sql-insert.html
Description:

The grammar
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
seems wrong to me. I appears to say it could be either
RETURNING *
or
output_expression [ [ AS ] output_name ] [, ...]

but I believe the RETURNING is always required.


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: INSERT ... RETURNING documentation
@ 2024-07-25 21:27  David G. Johnston <david.g.johnston@gmail.com>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2024-07-25 21:27 UTC (permalink / raw)
  To: masondeanm@aol.com <masondeanm@aol.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

On Thursday, July 25, 2024, PG Doc comments form <noreply@postgresql.org>
wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/16/sql-insert.html
> Description:
>
> The grammar
> [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
> seems wrong to me. I appears to say it could be either
> RETURNING *
> or
> output_expression [ [ AS ] output_name ] [, ...]
>
> but I believe the RETURNING is always required.
>

Yes, the word returning makes it the returning clause.  This should be
written:

[ Returning { * | output_expression [ [ AS ] output_name ] } [, …] ]

Here and on the update and delete pages.

Related, select says:

[ * | expression [ [ AS ] output_name ] [, …] ]

Shouldn’t this also be:

[ { * | expression [ [ AS ] output_name ] } [, …] ]

I know we do tend to let the reader infer exactly what the [, …] part
refers to but in this case it seems reasonably ambiguous.  I just think
most everyone learns how * works separately so it rarely comes up since no
one reads the syntax for it.


David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: INSERT ... RETURNING documentation
@ 2024-07-25 21:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2024-07-25 21:42 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: masondeanm@aol.com <masondeanm@aol.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thursday, July 25, 2024, PG Doc comments form <noreply@postgresql.org>
> wrote:
>> The grammar
>> [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
>> seems wrong to me.

> Yes, the word returning makes it the returning clause.  This should be
> written:

> [ Returning { * | output_expression [ [ AS ] output_name ] } [, …] ]

Agreed.

> Related, select says:

> [ * | expression [ [ AS ] output_name ] [, …] ]

I imagine the RETURNING synopsis was copied from that one :-(
Yes, let's change that too.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-07-25 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-25 20:35 INSERT ... RETURNING documentation PG Doc comments form <noreply@postgresql.org>
2024-07-25 21:27 ` David G. Johnston <david.g.johnston@gmail.com>
2024-07-25 21:42   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox