git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d00fbdc)
Use lfirst_int in cmp_list_len_contents_asc
2021年3月19日 22:57:50 +0000 (23:57 +0100)
2021年3月19日 23:04:25 +0000 (00:04 +0100)
The function added in be45be9c33 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


diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 1a745b742e080f999b8ce0dc4554bc6d6153b287..7c3e01aa22b5a9e96b7d476138a50ae35d30a0c3 100644 (file)
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -1750,8 +1750,8 @@ cmp_list_len_contents_asc(const ListCell *a, const ListCell *b)
forboth(lca, la, lcb, lb)
{
- int va = intVal(lca);
- int vb = intVal(lcb);
+ int va = lfirst_int(lca);
+ int vb = lfirst_int(lcb);
if (va > vb)
return 1;
if (va < vb)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /