aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/palloc.h
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-02-27 08:30:06 -0500
committerPeter Eisentraut <peter_e@gmx.net>2017-02-27 08:54:51 -0500
commit2ed193c904679a533d5e26a27c97119793bcae52 (patch)
tree20750d69786c8fc97f345e40521334e962221215 /src/include/utils/palloc.h
parent9fab40ad32efa4038d19eaed975bb4c1713ccbc0 (diff)
downloadpostgresql-2ed193c904679a533d5e26a27c97119793bcae52.tar.gz
postgresql-2ed193c904679a533d5e26a27c97119793bcae52.zip
chomp PQerrorMessage() in backend uses
PQerrorMessage() returns an error message with a trailing newline, but in backend use (dblink, postgres_fdw, libpqwalreceiver), we want to have the error message without that for emitting via ereport(). To simplify that, add a function pchomp() that returns a pstrdup'ed string with the trailing newline characters removed.
Diffstat (limited to 'src/include/utils/palloc.h')
-rw-r--r--src/include/utils/palloc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h
index b72fe4aee8c..2e07bd57ad4 100644
--- a/src/include/utils/palloc.h
+++ b/src/include/utils/palloc.h
@@ -127,6 +127,8 @@ extern char *MemoryContextStrdup(MemoryContext context, const char *string);
extern char *pstrdup(const char *in);
extern char *pnstrdup(const char *in, Size len);
+extern char *pchomp(const char *in);
+
/* sprintf into a palloc'd buffer --- these are in psprintf.c */
extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2);
extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0);