]> granicus.if.org Git - postgresql/commitdiff
Further fixing to make pg_size_bytes() portable.
authorDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 20 Feb 2016 15:49:26 +0000 (15:49 +0000)
committerDean Rasheed <dean.a.rasheed@gmail.com>
Sat, 20 Feb 2016 15:49:26 +0000 (15:49 +0000)
Not all compilers support "long long" and the "LL" integer literal
suffix, so use a cast to int64 instead.

src/backend/utils/adt/dbsize.c

index ba84c48cfd731f16ef71d4bb9554ec7272c6be5c..1db4acf175e1c94cfd45e83755f278be87df1c28 100644 (file)
@@ -813,15 +813,15 @@ pg_size_bytes(PG_FUNCTION_ARGS)
 
                /* Parse the unit case-insensitively */
                if (pg_strcasecmp(strptr, "bytes") == 0)
-                       multiplier = 1;
+                       multiplier = (int64) 1;
                else if (pg_strcasecmp(strptr, "kb") == 0)
-                       multiplier = 1024;
+                       multiplier = (int64) 1024;
                else if (pg_strcasecmp(strptr, "mb") == 0)
-                       multiplier = 1024 * 1024;
+                       multiplier = (int64) 1024 * 1024;
                else if (pg_strcasecmp(strptr, "gb") == 0)
-                       multiplier = 1024 * 1024 * 1024;
+                       multiplier = (int64) 1024 * 1024 * 1024;
                else if (pg_strcasecmp(strptr, "tb") == 0)
-                       multiplier = 1024 * 1024 * 1024 * 1024LL;
+                       multiplier = (int64) 1024 * 1024 * 1024 * 1024;
                else
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),