diff options
Diffstat (limited to 'src/bin/pg_dump/pg_backup_null.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_null.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_null.c index abff1138fc2..634aa6f1759 100644 --- a/src/bin/pg_dump/pg_backup_null.c +++ b/src/bin/pg_dump/pg_backup_null.c @@ -23,6 +23,7 @@ */ #include "pg_backup_archiver.h" +#include "dumputils.h" #include <unistd.h> /* for dup */ @@ -101,16 +102,16 @@ _WriteBlobData(ArchiveHandle *AH, const void *data, size_t dLen) { if (dLen > 0) { - unsigned char *str; - size_t len; + PQExpBuffer buf = createPQExpBuffer(); - str = PQescapeBytea((const unsigned char *) data, dLen, &len); - if (!str) - die_horribly(AH, NULL, "out of memory\n"); + appendByteaLiteralAHX(buf, + (const unsigned char *) data, + dLen, + AH); - ahprintf(AH, "SELECT lowrite(0, '%s');\n", str); + ahprintf(AH, "SELECT pg_catalog.lowrite(0, %s);\n", buf->data); - free(str); + destroyPQExpBuffer(buf); } return dLen; } |