From: Alvaro Herrera Date: Fri, 7 Apr 2017 22:27:00 +0000 (-0300) Subject: Fix printf format to use %zd when printing sizes X-Git-Tag: REL_10_BETA1~333 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8acc1e0fe21015d403c0e005d92d04250ece84b9;p=postgresql Fix printf format to use %zd when printing sizes 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 --- diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c index 1a90e4b715..fee07c6b34 100644 --- a/src/backend/statistics/dependencies.c +++ b/src/backend/statistics/dependencies.c @@ -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 */ diff --git a/src/backend/statistics/mvdistinct.c b/src/backend/statistics/mvdistinct.c index 6082ff01a9..ece544b3a3 100644 --- a/src/backend/statistics/mvdistinct.c +++ b/src/backend/statistics/mvdistinct.c @@ -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))); /*