From: Vik Fearing <vik@postgresfriends.org>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Missing grammar production for WITH TIES
Date: Mon, 18 May 2020 16:41:23 +0200
Message-ID: <6aa690ef-551d-e24f-2690-c38c2442947c@postgresfriends.org> (raw)
The syntax for FETCH FIRST allows the <fetch first quantity> to be
absent (implying 1).
We implement this correctly for ONLY, but WITH TIES didn't get the memo.
Patch attached.
--
Vik Fearing
Attachments:with_ties.diff (text/x-patch, 555B) downloaddiff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.yindex 3c78f2d1b5..a24b30f06f 100644--- a/src/backend/parser/gram.y+++ b/src/backend/parser/gram.y@@ -11816,6 +11816,14 @@ limit_clause:
n->limitOption = LIMIT_OPTION_COUNT;
$$ = n;
}
+ | FETCH first_or_next row_or_rows WITH TIES+ {+ SelectLimit *n = (SelectLimit *) palloc(sizeof(SelectLimit));+ n->limitOffset = NULL;+ n->limitCount = makeIntConst(1, -1);+ n->limitOption = LIMIT_OPTION_WITH_TIES;+ $$ = n;+ }
;
offset_clause:
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: vik@postgresfriends.org, pgsql-hackers@lists.postgresql.org
Subject: Re: Missing grammar production for WITH TIES
In-Reply-To: <6aa690ef-551d-e24f-2690-c38c2442947c@postgresfriends.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox