Re: [patch] [doc] Minor variable related cleanup and rewording of plpgsql docs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [patch] [doc] Minor variable related cleanup and rewording of plpgsql docs
Date: 2021-03-12 21:40:25
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> I do agree that the delineation of "returns records or not" is not ideal
> here. SELECT, then INSERT/UPDATE/DELETE (due to their shared RETURNING
> dynamic), then "DML commands", then "DMS exceptions" (these last two
> ideally leveraging the conceptual work noted above). That said, I do not
> think this is such a big issue as to warrant that much of a rewrite.

I took a stab at doing that, just to see what it might look like.
I thought it comes out pretty well, really -- see what you think.

(This still uses the terminology "optimizable statement", but I'm open
to replacing that with something else.)

> In the following I'm confused as to why "column reference" is specified
> since those are not substituted:
> "Parameters will only be substituted in places where a parameter or
> column reference is syntactically allowed."

The meaning of "column reference" there is, I think, a reference to
a column of a table being read by a query. In the counterexample
of "INSERT INTO mytable (col) ...", "col" cannot be replaced by a
data value. But in "INSERT INTO mytable (col) SELECT foo FROM bar",
"foo" is a candidate for replacement, even though it's likely meant
as a reference to

> I'm not married to my explicit calling out of identifiers not being
> substitutable but that does tend to be what people try to do.

The problem I had with it was that it didn't help clarify this
distinction. I'm certainly open to changes that do clarify that.

regards, tom lane

Attachment Content-Type Size
v4-doc-plpgsql-variable-usage-cleanup.patch text/x-diff 10.2 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-03-12 21:41:15 Re: documentation fix for SET ROLE
Previous Message Mark Rofail 2021-03-12 21:32:27 Re: [HACKERS] GSoC 2017: Foreign Key Arrays