From 7ee3c351522694dc6f8f0d6578394bdf5dec0b59 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 8 Aug 2004 06:44:36 +0000 Subject: Allow libpgport to call memory allocation routines even though CurrentMemoryContext is DLLIMPORT on Win32. Work around that by creating stubs in the backend for palloc/pstrdup. Also fix pg_dumpall to do proper quoting on Win32. --- src/bin/pg_dump/pg_dumpall.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/bin') diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index d260f2c0b2..a79cf836b2 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.46 2004/08/04 21:34:12 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.47 2004/08/08 06:44:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -840,21 +840,39 @@ runPgDump(const char *dbname) const char *p; int ret; + /* + * Win32 has to use double-quotes for args, rather than single quotes. + * Strangely enough, this is the only place we pass a database name + * on the command line, except template1 that doesn't need quoting. + */ +#ifndef WIN32 appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp '", SYSTEMQUOTE, pg_dump_bin, +#else + appendPQExpBuffer(cmd, "%s\"%s\" %s -Fp \"", SYSTEMQUOTE, pg_dump_bin, +#endif pgdumpopts->data); /* Shell quoting is not quite like SQL quoting, so can't use fmtId */ for (p = dbname; *p; p++) { +#ifndef WIN32 if (*p == '\'') appendPQExpBuffer(cmd, "'\"'\"'"); else +#endif + /* not needed on Win32 */ appendPQExpBufferChar(cmd, *p); } +#ifndef WIN32 appendPQExpBufferChar(cmd, '\''); - appendStringLiteral(cmd, SYSTEMQUOTE, false); +#else + appendPQExpBufferChar(cmd, '"'); +#endif + if (strlen(SYSTEMQUOTE) > 0) + appendPQExpBuffer(cmd, SYSTEMQUOTE); + if (verbose) fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data); -- cgit v1.2.1