mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-10 13:07:38 +08:00
The previous implementation got it right in most cases but failed in one: if you pg_dump into an archive with standard_conforming_strings enabled, then pg_restore to a script file (not directly to a database), the script will set standard_conforming_strings = on but then emit large object data as nonstandardly-escaped strings. At the moment the code is made to emit hex-format bytea strings when dumping to a script file. We might want to change to old-style escaping for backwards compatibility, but that would be slower and bulkier. If we do, it's just a matter of reimplementing appendByteaLiteral(). This has been broken for a long time, but given the lack of field complaints I'm not going to worry about back-patching.
46 lines
1.7 KiB
C
46 lines
1.7 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* Utility routines for SQL dumping
|
|
* Basically this is stuff that is useful in both pg_dump and pg_dumpall.
|
|
* Lately it's also being used by psql and bin/scripts/ ...
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $PostgreSQL: pgsql/src/bin/pg_dump/dumputils.h,v 1.25 2009/08/04 21:56:08 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef DUMPUTILS_H
|
|
#define DUMPUTILS_H
|
|
|
|
#include "libpq-fe.h"
|
|
#include "pqexpbuffer.h"
|
|
|
|
extern void init_parallel_dump_utils(void);
|
|
extern const char *fmtId(const char *identifier);
|
|
extern void appendStringLiteral(PQExpBuffer buf, const char *str,
|
|
int encoding, bool std_strings);
|
|
extern void appendStringLiteralConn(PQExpBuffer buf, const char *str,
|
|
PGconn *conn);
|
|
extern void appendStringLiteralDQ(PQExpBuffer buf, const char *str,
|
|
const char *dqprefix);
|
|
extern void appendByteaLiteral(PQExpBuffer buf,
|
|
const unsigned char *str, size_t length,
|
|
bool std_strings);
|
|
extern int parse_version(const char *versionString);
|
|
extern bool parsePGArray(const char *atext, char ***itemarray, int *nitems);
|
|
extern bool buildACLCommands(const char *name, const char *subname,
|
|
const char *type, const char *acls, const char *owner,
|
|
int remoteVersion,
|
|
PQExpBuffer sql);
|
|
extern void processSQLNamePattern(PGconn *conn, PQExpBuffer buf,
|
|
const char *pattern,
|
|
bool have_where, bool force_escape,
|
|
const char *schemavar, const char *namevar,
|
|
const char *altnamevar, const char *visibilityrule);
|
|
|
|
#endif /* DUMPUTILS_H */
|