diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 25d7110c13..ef67289d29 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -574,10 +574,11 @@ pg_size_pretty(PG_FUNCTION_ARGS) for (unit = size_pretty_units; unit->name != NULL; unit++) { + uint64 usize = size < 0 ? (uint64) (-size) : (uint64) size; uint8 bits; /* use this unit if there are no more units or we're below the limit */ - if (unit[1].name == NULL || i64abs(size) < unit->limit) + if (unit[1].name == NULL || usize < unit->limit) { if (unit->round) size = half_rounded(size);