]> granicus.if.org Git - postgresql/commitdiff
Fix printf format to use %zd when printing sizes
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 7 Apr 2017 22:27:00 +0000 (19:27 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 7 Apr 2017 22:27:00 +0000 (19:27 -0300)
Using %ld as we were doing raises compiler warnings on 32 bit platforms.

Reported by Andres Freund.
Discussion: https://postgr.es/m/20170407214022.fidezl2e6rk3tuiz@alap3.anarazel.de

src/backend/statistics/dependencies.c
src/backend/statistics/mvdistinct.c

index 1a90e4b7157ab5b2dca9820d8b67d5755e5ed806..fee07c6b34dad0f81d2794e48154683310eda38d 100644 (file)
@@ -511,7 +511,7 @@ statext_dependencies_deserialize(bytea *data)
                return NULL;
 
        if (VARSIZE_ANY_EXHDR(data) < SizeOfDependencies)
-               elog(ERROR, "invalid MVDependencies size %ld (expected at least %ld)",
+               elog(ERROR, "invalid MVDependencies size %zd (expected at least %zd)",
                         VARSIZE_ANY_EXHDR(data), SizeOfDependencies);
 
        /* read the MVDependencies header */
@@ -547,7 +547,7 @@ statext_dependencies_deserialize(bytea *data)
                                                           sizeof(AttrNumber) * 2);
 
        if (VARSIZE_ANY_EXHDR(data) < min_expected_size)
-               elog(ERROR, "invalid dependencies size %ld (expected at least %ld)",
+               elog(ERROR, "invalid dependencies size %zd (expected at least %zd)",
                         VARSIZE_ANY_EXHDR(data), min_expected_size);
 
        /* allocate space for the MCV items */
index 6082ff01a9a91cf124ffd1ebe7789a539ac351fb..ece544b3a3c0232a0f01280dcde916aebfd1bf6b 100644 (file)
@@ -238,7 +238,7 @@ statext_ndistinct_deserialize(bytea *data)
 
        /* we expect at least the basic fields of MVNDistinct struct */
        if (VARSIZE_ANY_EXHDR(data) < SizeOfMVNDistinct)
-               elog(ERROR, "invalid MVNDistinct size %ld (expected at least %ld)",
+               elog(ERROR, "invalid MVNDistinct size %zd (expected at least %zd)",
                         VARSIZE_ANY_EXHDR(data), SizeOfMVNDistinct);
 
        /* initialize pointer to the data part (skip the varlena header) */
@@ -274,7 +274,7 @@ statext_ndistinct_deserialize(bytea *data)
        if (VARSIZE_ANY_EXHDR(data) < minimum_size)
                ereport(ERROR,
                                (errcode(ERRCODE_DATA_CORRUPTED),
-                                errmsg("invalid MVNDistinct size %ld (expected at least %ld)",
+                                errmsg("invalid MVNDistinct size %zd (expected at least %zd)",
                                                VARSIZE_ANY_EXHDR(data), minimum_size)));
 
        /*