Skip to content

Commit b822ae1

Browse files
committed
Use lfirst_int in cmp_list_len_contents_asc
The function added in be45be9 is comparing integer lists (IntList) by length and contents, but there were two bugs. Firstly, it used intVal() to extract the value, but that's for Value nodes, not for extracting int values from IntList. Secondly, it called it directly on the ListCell, without doing lfirst(). So just do lfirst_int() instead. Interestingly enough, this did not cause any crashes on the buildfarm, but valgrind rightfully complained about it. Discussion: https://postgr.es/m/bf3805a8-d7d1-ae61-fece-761b7ff41ecc@postgresfriends.org
1 parent d00fbdc commit b822ae1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/parser/parse_agg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,8 +1750,8 @@ cmp_list_len_contents_asc(const ListCell *a, const ListCell *b)
17501750

17511751
forboth(lca, la, lcb, lb)
17521752
{
1753-
int va = intVal(lca);
1754-
int vb = intVal(lcb);
1753+
int va = lfirst_int(lca);
1754+
int vb = lfirst_int(lcb);
17551755
if (va > vb)
17561756
return 1;
17571757
if (va < vb)

0 commit comments

Comments
 (0)