diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-05-28 21:13:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-05-28 21:13:54 +0000 |
commit | 134b463f027d1113df6f983c3348f165b1ac1ffa (patch) | |
tree | 7e247256f1fcb5e0e1a4759b854f673366c4478d /src/bin/scripts/createdb.c | |
parent | 117d73a9e7af61f6742e3d2b46f1dfbe3e02b9ca (diff) | |
download | postgresql-134b463f027d1113df6f983c3348f165b1ac1ffa.tar.gz postgresql-134b463f027d1113df6f983c3348f165b1ac1ffa.zip |
Fix up pg_dump to do string escaping fully correctly for client encoding
and standard_conforming_strings; likewise for the other client programs
that need it. As per previous discussion, a pg_dump dump now conforms
to the standard_conforming_strings setting of the source database.
We don't use E'' syntax in the dump, thereby improving portability of
the SQL. I added a SET escape_strings_warning = off command to keep
the dumps from getting a lot of back-chatter from that.
Diffstat (limited to 'src/bin/scripts/createdb.c')
-rw-r--r-- | src/bin/scripts/createdb.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index 7413cdec52c..ec022b12036 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.17 2006/05/26 23:48:54 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.18 2006/05/28 21:13:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -183,11 +183,12 @@ main(int argc, char *argv[]) if (comment) { + conn = connectDatabase(dbname, host, port, username, password, progname); + printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname)); - appendStringLiteral(&sql, comment, false, true); + appendStringLiteralConn(&sql, comment, conn); appendPQExpBuffer(&sql, ";\n"); - conn = connectDatabase(dbname, host, port, username, password, progname); if (echo) printf("%s", sql.data); result = PQexec(conn, sql.data); |