aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-03-15 11:10:41 -0400
committerPeter Eisentraut <peter_e@gmx.net>2018-03-15 11:41:42 -0400
commit3a4b891964a531aa7d242a48fcd9e41379863ead (patch)
treecda1cef77f04c277d8001bf3049b3366b551b4e5 /src/backend/commands/explain.c
parent648a6c7bd815f98b35709bd56f9f1ca276b33ae6 (diff)
downloadpostgresql-3a4b891964a531aa7d242a48fcd9e41379863ead.tar.gz
postgresql-3a4b891964a531aa7d242a48fcd9e41379863ead.zip
Fix more format truncation issues
Fix the warnings created by the compiler warning options -Wformat-overflow=2 -Wformat-truncation=2, supported since GCC 7. This is a more aggressive variant of the fixes in 6275f5d28a1577563f53f2171689d4f890a46881, which GCC 7 warned about by default. The issues are all harmless, but some dubious coding patterns are cleaned up. One issue that is of external interest is that BGW_MAXLEN is increased from 64 to 96. Apparently, the old value would cause the bgw_name of logical replication workers to be truncated in some circumstances. But this doesn't actually add those warning options. It appears that the warnings depend a bit on compilation and optimization options, so it would be annoying to have to keep up with that. This is more of a once-in-a-while cleanup. Reviewed-by: Michael Paquier <michael@paquier.xyz>
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 900fa74e85e..f0dfef5a86d 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -3337,10 +3337,11 @@ void
ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
ExplainState *es)
{
- char buf[256];
+ char *buf;
- snprintf(buf, sizeof(buf), "%.*f", ndigits, value);
+ buf = psprintf("%.*f", ndigits, value);
ExplainProperty(qlabel, buf, true, es);
+ pfree(buf);
}
/*