Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jM029-0007ek-RL for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 02:01:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jM028-0006KB-QA for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Apr 2020 02:01:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jM028-0006K4-JL for pgsql-hackers@lists.postgresql.org; Wed, 08 Apr 2020 02:01:40 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jM026-0003es-DY for pgsql-hackers@postgresql.org; Wed, 08 Apr 2020 02:01:40 +0000 Received: from [192.168.127.1] (port=59412 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1jM022-000Fw2-T7; Wed, 08 Apr 2020 02:01:34 +0000 Received: from localhost ([127.0.0.1]:18647 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1jM022-0006Eg-Bq; Wed, 08 Apr 2020 02:01:34 +0000 From: Andrew Gierth To: Alvaro Herrera Cc: Surafel Temesgen , Tomas Vondra , PostgreSQL Hackers Subject: Re: FETCH FIRST clause WITH TIES option In-Reply-To: <20200407203654.GA15931@alvherre.pgsql> (Alvaro Herrera's message of "Tue, 7 Apr 2020 16:36:54 -0400") Message-ID: <87a73mn4cl.fsf@news-spur.riddles.org.uk> References: <20200407203654.GA15931@alvherre.pgsql> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) Date: Wed, 08 Apr 2020 03:01:33 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Alvaro" == Alvaro Herrera writes: Alvaro> It turns out that the SQL standard is much more limited in what Alvaro> it will accept there. But our grammar (what we'll accept for Alvaro> the ancient LIMIT clause) is very lenient -- it'll take just Alvaro> any expression. I thought about reducing that to NumericOnly Alvaro> for FETCH FIRST .. WITH TIES, but then I have to pick: 1) Alvaro> gram.y fails to compile because of a reduce/reduce conflict, or Alvaro> 2) also restricting FETCH FIRST .. ONLY to NumericOnly. Neither Alvaro> of those seemed very palatable. FETCH FIRST ... ONLY was made _too_ restrictive initially, such that it didn't allow parameters (which are allowed by the spec); see 1da162e1f. (That change didn't present a problem for ruleutils, because FETCH FIRST ... ONLY is output as a LIMIT clause instead.) This needs to be fixed in ruleutils, IMO, not by changing what the grammar accepts. -- Andrew.