pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Please make a note regarding the PL/pgSQL FOUND variable
3+ messages / 3 participants
[nested] [flat]

* Please make a note regarding the PL/pgSQL FOUND variable
@ 2023-11-02 16:42  PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2023-11-02 16:42 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: tomtrias@gmail.com

The following documentation comment has been logged on the website:

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

Since I was recently bitten by the fact that CREATE TABLE AS doesn't set the
PL/pgSQL variable FOUND, it would be nice if that were explicitly noted in
the documentation.  Alternatively, if it COULD set the FOUND variable, that
would be great, although I realize the difficulty of that when coupled with
IF NOT EXISTS.


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

* Re: Please make a note regarding the PL/pgSQL FOUND variable
@ 2023-11-04 15:16  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Doc comments form <noreply@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2023-11-04 15:16 UTC (permalink / raw)
  To: tomtrias@gmail.com; +Cc: pgsql-docs@lists.postgresql.org

PG Doc comments form <noreply@postgresql.org> writes:
> Since I was recently bitten by the fact that CREATE TABLE AS doesn't set the
> PL/pgSQL variable FOUND, it would be nice if that were explicitly noted in
> the documentation.  Alternatively, if it COULD set the FOUND variable, that
> would be great, although I realize the difficulty of that when coupled with
> IF NOT EXISTS.

The documentation of FOUND is already quite explicit about which kinds
of statements set it:

https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS

I'm disinclined to put notes about PL/pgSQL features into command
reference pages that have nothing to do with PL/pgSQL.

			regards, tom lane





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

* Re: Please make a note regarding the PL/pgSQL FOUND variable
@ 2023-11-04 15:23  Thomas Trias <tomtrias@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Trias @ 2023-11-04 15:23 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-docs@lists.postgresql.org

Perhaps it could be explicitly stated on that page, then? Part of the
confusion arises from the semantic differences between SELECT INTO and
CREATE TABLE AS SELECT solely as used within PL/pgSQL, which is exacerbated
for people coming from a different SQL variant, such as T-SQL. I agree that
the documentation is explicit regarding which statements are supported for
FOUND, but this would be the explicit enumeration of a case where it is not
that has enough overlap with the supported cases as to potentially lead to
confusion. I do not think such could possibly detract from the
documentation in any way.

On Sat, Nov 4, 2023 at 10:16 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> PG Doc comments form <noreply@postgresql.org> writes:
> > Since I was recently bitten by the fact that CREATE TABLE AS doesn't set
> the
> > PL/pgSQL variable FOUND, it would be nice if that were explicitly noted
> in
> > the documentation.  Alternatively, if it COULD set the FOUND variable,
> that
> > would be great, although I realize the difficulty of that when coupled
> with
> > IF NOT EXISTS.
>
> The documentation of FOUND is already quite explicit about which kinds
> of statements set it:
>
>
> https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICS
>
> I'm disinclined to put notes about PL/pgSQL features into command
> reference pages that have nothing to do with PL/pgSQL.
>
>                         regards, tom lane
>

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


end of thread, other threads:[~2023-11-04 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 16:42 Please make a note regarding the PL/pgSQL FOUND variable PG Doc comments form <noreply@postgresql.org>
2023-11-04 15:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-11-04 15:23   ` Thomas Trias <tomtrias@gmail.com>

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