postgres.git / summary / log / commit / refs

commit    8d29d45d9b3cab95a866efbcdd9138b3d76741b3
Author:   David Rowley <drowley@postgresql.org>
Date:     Mon Jun 21 11:11:23 2021 +0000

    Fix assert failure in expand_grouping_sets
    
    linitial_node() fails in assert enabled builds if the given pointer is
    not of the specified type.  Here the type is IntList.  The code thought
    it should be expecting List, but it was wrong.
    
    In the existing tests which run this code the initial list element is
    always NIL.  Since linitial_node() allows NULL, we didn't trigger any
    assert failures in the existing regression tests.
    
    There is still some discussion as to whether we need a few more tests in
    this area, but for now, since beta2 is looming, fix the bug first.
    
    Bug: #17067
    Discussion: https://postgr.es/m/17067-665d50fa321f79e0@postgresql.org
    Reported-by: Yaoguang Chen


src/backend/parser/parse_agg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 9562ffcf3e2..a25f8d5b989 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -1855,7 +1855,7 @@ expand_grouping_sets(List *groupingSets, bool groupDistinct, int limit) list_sort(result, cmp_list_len_contents_asc); /* Finally, remove duplicates */ - prev = linitial_node(List, result); + prev = linitial(result); for_each_from(cell, result, 1) { if (equal(lfirst(cell), prev)) [parent: a7bb0ce58f56]