aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-03-18 19:24:22 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-03-18 19:24:22 -0400
commit1d581ce7129d7a33cd4ad27f8f246abfa1fd2db9 (patch)
treee61e04b6ec6f070b41f38f0b267c7179a42e6696
parentbe45be9c33a85e72cdaeb9967e9f6d2d00199e09 (diff)
downloadpostgresql-1d581ce7129d7a33cd4ad27f8f246abfa1fd2db9.tar.gz
postgresql-1d581ce7129d7a33cd4ad27f8f246abfa1fd2db9.zip
Fix misuse of foreach_delete_current().
Our coding convention requires this macro's result to be assigned back to the original List variable. In this usage, since the List could not become empty, there was no actual bug --- but some compilers warned about it. Oversight in be45be9c3. Discussion: https://postgr.es/m/35077b31-2d62-1e31-0e2e-ddb52d590b73@enterprisedb.com
-rw-r--r--src/backend/parser/parse_agg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 899327aaf4e..1a745b742e0 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -1844,11 +1844,11 @@ expand_grouping_sets(List *groupingSets, bool groupDistinct, int limit)
list_sort(result, cmp_list_len_contents_asc);
/* Finally, remove duplicates */
- prev = list_nth_node(List, result, 0);
+ prev = linitial_node(List, result);
for_each_from(cell, result, 1)
{
if (equal(lfirst(cell), prev))
- foreach_delete_current(result, cell);
+ result = foreach_delete_current(result, cell);
else
prev = lfirst(cell);
}