aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/dumputils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-06-01 00:15:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-06-01 00:15:36 +0000
commit6178762fcf02f5f07099ff2277f8cdd82151cd0e (patch)
tree5062f78532e80a62014ccf43ac9d53164913136e /src/bin/pg_dump/dumputils.c
parent2703007501e883f6f9968c274cf118f6cf362ebd (diff)
downloadpostgresql-6178762fcf02f5f07099ff2277f8cdd82151cd0e.tar.gz
postgresql-6178762fcf02f5f07099ff2277f8cdd82151cd0e.zip
Fix up hack to suppress escape_string_warning so that it actually works
and there's only one place that's a kluge, ie, appendStringLiteralConn. Note that pg_dump itself doesn't use appendStringLiteralConn, so its behavior is not affected; only the other utility programs care.
Diffstat (limited to 'src/bin/pg_dump/dumputils.c')
-rw-r--r--src/bin/pg_dump/dumputils.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c
index bad85e2bda5..8648c2f5590 100644
--- a/src/bin/pg_dump/dumputils.c
+++ b/src/bin/pg_dump/dumputils.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.29 2006/05/28 21:13:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.c,v 1.30 2006/06/01 00:15:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -191,6 +191,21 @@ appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
{
size_t length = strlen(str);
+ /*
+ * XXX This is a kluge to silence escape_string_warning in our utility
+ * programs. It should go away someday.
+ */
+ if (strchr(str, '\\') != NULL && PQserverVersion(conn) >= 80100)
+ {
+ /* ensure we are not adjacent to an identifier */
+ if (buf->len > 0 && buf->data[buf->len-1] != ' ')
+ appendPQExpBufferChar(buf, ' ');
+ appendPQExpBufferChar(buf, ESCAPE_STRING_SYNTAX);
+ appendStringLiteral(buf, str, PQclientEncoding(conn), false);
+ return;
+ }
+ /* XXX end kluge */
+
if (!enlargePQExpBuffer(buf, 2 * length + 2))
return;
appendPQExpBufferChar(buf, '\'');