diff options
| author | Peter Eisentraut | 2017-02-27 13:30:06 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2017-02-27 13:54:51 +0000 |
| commit | 2ed193c904679a533d5e26a27c97119793bcae52 (patch) | |
| tree | 20750d69786c8fc97f345e40521334e962221215 /src/include | |
| parent | 9fab40ad32efa4038d19eaed975bb4c1713ccbc0 (diff) | |
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')
| -rw-r--r-- | src/include/utils/palloc.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index b72fe4aee8..2e07bd57ad 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); |
