Re: Fix for FETCH FIRST syntax problems
Andrew Gierth <andrew@tao11.riddles.org.uk>
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Date: 2018-05-20T00:36:10Z
Lists: pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes: Tom> Also, why'd you back off "must write" to "should write" in the docs? Tom> This doesn't make the parens any more optional than before. Currently, the requirement for parens is inconsistent - FETCH FIRST wants them for absolutely anything that's not a literal constant, but OFFSET x ROWS allows any c_expr (which covers a whole lot of ground in addition to the spec's requirements). The docs don't distinguish these two and just say "must write" parens even though some cases clearly work without. (There's also the slight wart that OFFSET -1 ROWS is a syntax error, whereas the spec defines it as valid syntax but a semantic error. Do we care?) With the patch, c_exprs would be accepted without parens, so saying "must write" parens in the docs clearly isn't entirely accurate. I'm open to better phrasing. I found some more warts: OFFSET +1 ROWS isn't accepted (but should be), and FETCH FIRST 10000000000 ROWS ONLY fails on 32bit and Windows builds. The patch as posted fixes the second of those but makes FETCH FIRST +1 fail instead; I'm working on that. -- Andrew (irc:RhodiumToad)
Commits
-
Fix SQL:2008 FETCH FIRST syntax to allow parameters.
- 89b09db01b43 9.3.24 landed
- 769e6fcd1a35 9.4.19 landed
- 3b0fb2529fdf 9.5.14 landed
- 7a0aa8d12ace 9.6.10 landed
- cf516dc9d690 10.5 landed
- 1da162e1f5a7 11.0 landed
-
SQL:2008 alternative syntax for LIMIT/OFFSET:
- 361bfc35724a 8.4.0 cited