Skip to content

Commit 740d718

Browse files
committed
Further fixing to make pg_size_bytes() portable.
Not all compilers support "long long" and the "LL" integer literal suffix, so use a cast to int64 instead.
1 parent ad7cc1c commit 740d718

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/backend/utils/adt/dbsize.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,15 +813,15 @@ pg_size_bytes(PG_FUNCTION_ARGS)
813813

814814
/* Parse the unit case-insensitively */
815815
if (pg_strcasecmp(strptr, "bytes") == 0)
816-
multiplier = 1;
816+
multiplier = (int64) 1;
817817
else if (pg_strcasecmp(strptr, "kb") == 0)
818-
multiplier = 1024;
818+
multiplier = (int64) 1024;
819819
else if (pg_strcasecmp(strptr, "mb") == 0)
820-
multiplier = 1024 * 1024;
820+
multiplier = (int64) 1024 * 1024;
821821
else if (pg_strcasecmp(strptr, "gb") == 0)
822-
multiplier = 1024 * 1024 * 1024;
822+
multiplier = (int64) 1024 * 1024 * 1024;
823823
else if (pg_strcasecmp(strptr, "tb") == 0)
824-
multiplier = 1024 * 1024 * 1024 * 1024LL;
824+
multiplier = (int64) 1024 * 1024 * 1024 * 1024;
825825
else
826826
ereport(ERROR,
827827
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy