Thread: [DOCS] DECLARE syntax is different from the 2016 SQL standard
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
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 "CURSOR" keyword before the > "FOR" 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
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
Elliot Chance
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 "CURSOR" keyword before the
> "FOR" 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
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