Re: FETCH FIRST clause WITH TIES option - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: FETCH FIRST clause WITH TIES option
Date
Msg-id 20200407004925.GA23627@alvherre.pgsql
Whole thread Raw
In response to Re: FETCH FIRST clause WITH TIES option  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: FETCH FIRST clause WITH TIES option  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List 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



pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)
Next
From: Tomas Vondra
Date:
Subject: Re: [PATCH] Incremental sort (was: PoC: Partial sort)