Re: Global dict name is listed inconsistently

2018-08-26 Thread Adam
Yes, it does, thank you.

Now it's clear why there are two different names.

Best regards,

Adam Bielański

pt., 24 sie 2018, 20:05 użytkownik Bruce Momjian  napisał:

> On Tue, Aug 21, 2018 at 09:17:35AM +, PG Doc comments form wrote:
> > The following documentation comment has been logged on the website:
> >
> > Page: https://www.postgresql.org/docs/10/static/plpython-sharing.html
> > Description:
> >
> > Page https://www.postgresql.org/docs/10/static/plpython-sharing.html
> says:
> > "The global dictionary SD is available to store data between function
> > calls." few lines lower it says: "global data and function arguments from
> > myfunc are not available to myfunc2. The exception is the data in the GD
> > dictionary, as mentioned above." Note that the global dictionary is named
> > "SD" in the first quote and "GD" in the second one.
> >
> > Please correct either first or second sentence.
>
> Well, the documentation is correct, but obviously not clear.  I have the
> attached patch which modifies the documentation and clarifies this
> issue.  Does it help you?
>
> --
>   Bruce Momjian  http://momjian.us
>   EnterpriseDB http://enterprisedb.com
>
> + As you are, so once was I.  As I am, so you will be. +
> +  Ancient Roman grave inscription +
>


Re: unclear syntax explanation for multiple window definitions in a SELECT query

2023-02-16 Thread Adam Mackler
On Thursday, February 16th, 2023 at 5:13 PM, David G. Johnston 
 wrote:

> This is how we've chosen to document this kind of grammar and I don't see a 
> compelling reason to revisit that decision on the basis of this report. I 
> could consider some additional wording regarding "each clause keyword only 
> ever appears once in a given (sub)query" though that seems almost 
> self-evident as part of the learning of SQL. The fact that you write WINDOW 
> and then a comma-separated listing of names plus definitions is how that 
> syntax diagram is read, just like with WITH, FROM, and GROUP BY clauses in 
> the same diagram.

Yes, such additional wording would be helpful, thanks, as well as would be an 
example. Perhaps not in the SELECT reference section, but in section 4.2.8, 
which has a lot of detail about using window functions. Section 4.2.8 does have 
a single mention of existing_window_name in bold italics, as if it would be 
described in more detail lower on the page, but that's the only mention of it 
there.

The only instruction for how to have multiple window definitions is then in the 
SELECT reference, where it is represented only by [, ... ] indicating 
repetition of something, so that's good the reader at least knows it's 
possible, even if it's unclear exactly how. Inferring wrongly what the correct 
form is tripped me up, and it tripped up the guy who posted the question on SO, 
and at least six others upvoted the answer there, so at least a few people find 
value in being explicit about this.

Incidentally the other clauses you mention are all supported with examples in 
the manual showing how to include multiple elements without repeating the 
keyword: FROM in 2.6, WITH in 7.8.1, GROUP BY in 7.2.3. Besides the examples, 
that section 7.2.3 provides the syntax for GROUP BY as:

GROUP BY

grouping_column_reference

[

,

grouping_column_reference

]...

with grouping_column_reference repeated to indicate clearly that there is no 
keyword necessary before the second and subsequent elements, so at least in 
some contexts the clarity provided by such repetition is appropriate. 
Inconsistently the syntax given for WINDOW is:

WINDOW

window_name

AS (

window_definition

) [, ...]

rather than something like

WINDOW

window_name

AS (

window_definition

) [,

window_name

AS (

window_definition

)]...

Maybe the reference section for SELECT is the wrong place for that longer form, 
but section 4.2.8 (or some other referenced from there) could be.

Cheers,
--
Adam Mackler