|From:||Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>|
|To:||Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>|
|Cc:||Surafel Temesgen <surafel3000(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>|
|Subject:||Re: FETCH FIRST clause WITH TIES option|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Looking at this patch again. (Attached v13 fixes a typo in ruleutils,
fixes a bogus edit in the SGML docs plus minor rewording, and is rebased
to current master).
First, I noticed that there's a significant unanswered issue from Andrew
Gierth about this using a completely different mechanism, namely an
implicit window function. I see that Robert was concerned about the
performance of Andrew's proposed approach, but I don't see any reply
from Surafel on the whole issue.
Andrew: Would you rather not have this feature in this form at all?
Tomas, are you still intending to be committer for this?
There's also this point that was not discussed very much:
On 2018-Oct-28, Tomas Vondra wrote:
> One question is whether to make this work for LIMIT too, not just for
> FETCH FIRST. I'm not sure how difficult would that be (it should be a
> grammar-only tweak I guess), or if it's a good idea in general.
I was also thinking that it would be good to support the new clause
under the LIMIT spelling, but it turns out that there are shift/reduce
conflicts if done the naive way(*); fixing those looks to be rather major
surgery to the way we represent the LIMIT/OFFSET clauses.
I'm not sure the proposed changes to gram.y are all that great, though.
Right now we have separate productions offset_clause and limit_clause,
and a combination mechanism called select_limit; after the patch the
whole thing is a little bit too messy. Would it be sensible to unify/
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 72ad633102..01d337c30e 100644
@@ -11672,6 +11672,13 @@ limit_clause:
n->limitOption = LIMIT_OPTION_COUNT;
$$ = n;
+ | LIMIT select_limit_value WITH TIES
+ LimitClause *n = (LimitClause *) palloc(sizeof(LimitClause));
+ n->limitCount = $2;
+ n->limitOption = LIMIT_OPTION_WITH_TIES;
+ $$ = n;
| LIMIT select_limit_value ',' select_offset_value
/* Disabled because it was too confusing, bjm 2002-02-18 */
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
|Next Message||Konstantin Knizhnik||2019-11-11 15:19:21||Re: [Proposal] Global temporary tables|
|Previous Message||Konstantin Knizhnik||2019-11-11 14:54:42||Re: Global temporary tables|