Re: FETCH FIRST clause WITH TIES option

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Surafel Temesgen <surafel3000(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(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
Date: 2020-04-07 00:49:25
Message-ID: 20200407004925.GA23627@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Some ruleutils.c code added by this patch is not covered by tests:

5246 : /* Add the LIMIT clause if given */
5247 1115 : if (query->limitOffset != NULL)
5248 : {
5249 0 : appendContextKeyword(context, " OFFSET ",
5250 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
5251 0 : get_rule_expr(query->limitOffset, context, false);
5252 : }
5253 1115 : if (query->limitOption == LIMIT_OPTION_WITH_TIES)
5254 : {
5255 0 : appendContextKeyword(context, " FETCH FIRST ",
5256 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
5257 0 : get_rule_expr(query->limitCount, context, false);
5258 0 : appendContextKeyword(context, " ROWS WITH TIES ",
5259 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
5260 : }
5261 1115 : if (query->limitCount != NULL && query->limitOption != LIMIT_OPTION_WITH_TIES)
5262 : {
5263 2 : appendContextKeyword(context, " LIMIT ",
5264 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
5265 2 : if (IsA(query->limitCount, Const) &&
5266 0 : ((Const *) query->limitCount)->constisnull)
5267 0 : appendStringInfoString(buf, "ALL");
5268 : else
5269 2 : get_rule_expr(query->limitCount, context, false);
5270 : }

Other than that, the patch seems good to go to me, so unless there are
objections, I intend to get this pushed tomorrow.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2020-04-07 01:01:37 Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Previous Message James Coleman 2020-04-07 00:47:54 Re: [PATCH] Incremental sort (was: PoC: Partial sort)