aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2024-02-16 14:05:36 -0600
committerNathan Bossart <nathan@postgresql.org>2024-02-16 14:05:36 -0600
commit3b42bdb47169c617cb79123c407a19d16458b49a (patch)
tree90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /src/backend/utils/cache/relcache.c
parent6b80394781c8de17fe7cae6996476088af3c319f (diff)
downloadpostgresql-3b42bdb47169c617cb79123c407a19d16458b49a.tar.gz
postgresql-3b42bdb47169c617cb79123c407a19d16458b49a.zip
Use new overflow-safe integer comparison functions.
Commit 6b80394781 introduced integer comparison functions designed to be as efficient as possible while avoiding overflow. This commit makes use of these functions in many of the in-tree qsort() comparators to help ensure transitivity. Many of these comparator functions should also see a small performance boost. Author: Mats Kindahl Reviewed-by: Andres Freund, Fabrízio de Royes Mello Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index ac106b40e30..50acae45298 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -69,6 +69,7 @@
#include "commands/policy.h"
#include "commands/publicationcmds.h"
#include "commands/trigger.h"
+#include "common/int.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
@@ -4520,7 +4521,7 @@ AttrDefaultCmp(const void *a, const void *b)
const AttrDefault *ada = (const AttrDefault *) a;
const AttrDefault *adb = (const AttrDefault *) b;
- return ada->adnum - adb->adnum;
+ return pg_cmp_s16(ada->adnum, adb->adnum);
}
/*