DECLARE syntax is different from the 2016 SQL standard

Started by Elliot Chanceabout 9 years ago4 messagesdocs
Jump to latest
#1Elliot Chance
elliotchance@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.1/static/sql-declare.html
Description:

Hi,

The 2016 standard uses a different syntax to declare a cursor:

<declare cursor> ::=
DECLARE <cursor name> <cursor properties>
FOR <cursor specification>

Notice that it does not require or permit the "CURSOR" keyword before the
"FOR" keyword.

I don't know why this was changed and unfortunately fixing this would break
existing implementations, but there should be a note about this under the
SQL Standard section.

This was discovered with: https://github.com/elliotchance/sqltest

BNF for 2016 can be found in the same project:
https://github.com/elliotchance/sqltest/blob/master/standards/2016/bnf.txt#L2371-L2372

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Elliot Chance (#1)
Re: DECLARE syntax is different from the 2016 SQL standard

elliotchance@gmail.com writes:

The 2016 standard uses a different syntax to declare a cursor:

<declare cursor> ::=
DECLARE <cursor name> <cursor properties>
FOR <cursor specification>

Notice that it does not require or permit the &quot;CURSOR&quot; keyword before the
&quot;FOR&quot; keyword.

For some reason, the spec puts the CURSOR keyword into <cursor
properties>, but it's definitely there:

<cursor properties> ::=
[ <cursor sensitivity> ] [ <cursor scrollability> ] CURSOR
[ <cursor holdability> ]
[ <cursor returnability> ]

regards, tom lane

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

#3Elliot Chance
elliotchance@gmail.com
In reply to: Tom Lane (#2)
Re: DECLARE syntax is different from the 2016 SQL standard

Sorry, this was my mistake. If i just spent 60 more seconds reading the
rules properly I would have seen this.

Although... it has bought up another possible bug with docs. The "Report an
error" box (which I used to send the original message) seems to not be
escaping HTML correctly... as seen in the previous message.

--
Elliot Chance
https://elliot.land

On 14 March 2017 at 1:28:37 PM, Tom Lane (tgl@sss.pgh.pa.us) wrote:

elliotchance@gmail.com writes:

The 2016 standard uses a different syntax to declare a cursor:

<declare cursor> ::=
DECLARE <cursor name> <cursor properties>
FOR <cursor specification>

Notice that it does not require or permit the &quot;CURSOR&quot; keyword

before the

&quot;FOR&quot; keyword.

For some reason, the spec puts the CURSOR keyword into <cursor
properties>, but it's definitely there:

<cursor properties> ::=
[ <cursor sensitivity> ] [ <cursor scrollability> ] CURSOR
[ <cursor holdability> ]
[ <cursor returnability> ]

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Elliot Chance (#3)
Re: DECLARE syntax is different from the 2016 SQL standard

Elliot Chance <elliotchance@gmail.com> writes:

Although... it has bought up another possible bug with docs. The "Report an
error" box (which I used to send the original message) seems to not be
escaping HTML correctly... as seen in the previous message.

Yeah, our web team is aware of that ...

regards, tom lane

--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs