Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fKCKm-0005lK-CJ for pgsql-hackers@arkaria.postgresql.org; Sun, 20 May 2018 00:36:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fKCKh-0003Yv-K2 for pgsql-hackers@arkaria.postgresql.org; Sun, 20 May 2018 00:36:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fKCKh-0003Yi-9c for pgsql-hackers@lists.postgresql.org; Sun, 20 May 2018 00:36:19 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fKCKd-0005tp-8H for pgsql-hackers@postgresql.org; Sun, 20 May 2018 00:36:17 +0000 Received: from [192.168.127.1] (port=26100 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1fKCKa-00008N-3U; Sun, 20 May 2018 00:36:12 +0000 Received: from [127.0.0.1] (port=25512 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1fKCKZ-0002Pz-8a; Sun, 20 May 2018 00:36:11 +0000 From: Andrew Gierth To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Fix for FETCH FIRST syntax problems In-Reply-To: <22981.1526770675@sss.pgh.pa.us> (Tom Lane's message of "Sat, 19 May 2018 18:57:55 -0400") Message-ID: <8736yn43ub.fsf@news-spur.riddles.org.uk> References: <877enz476l.fsf@news-spur.riddles.org.uk> <22981.1526770675@sss.pgh.pa.us> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Sun, 20 May 2018 01:36:10 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Tom" == Tom Lane 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)