Re: INSERT ... RETURNING documentation

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "masondeanm(at)aol(dot)com" <masondeanm(at)aol(dot)com>, "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: INSERT ... RETURNING documentation
Date: 2024-07-25 21:27:08
Message-ID: CAKFQuwYZJykuHnbc3d_Ks2mQyca6cB0JeoWVHLsBPphgNbXgCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Thursday, July 25, 2024, PG Doc comments form <noreply(at)postgresql(dot)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.

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2024-07-25 21:42:03 Re: INSERT ... RETURNING documentation
Previous Message PG Doc comments form 2024-07-25 20:35:01 INSERT ... RETURNING documentation