PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
dumputils.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * Utility routines for SQL dumping
4  *
5  * Basically this is stuff that is useful in both pg_dump and pg_dumpall.
6  *
7  *
8  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
9  * Portions Copyright (c) 1994, Regents of the University of California
10  *
11  * src/bin/pg_dump/dumputils.h
12  *
13  *-------------------------------------------------------------------------
14  */
15 #ifndef DUMPUTILS_H
16 #define DUMPUTILS_H
17 
18 #include "libpq-fe.h"
19 #include "pqexpbuffer.h"
20 
21 /*
22  * Preferred strftime(3) format specifier for printing timestamps in pg_dump
23  * and friends.
24  *
25  * We don't print the timezone on Windows, because the names are long and
26  * localized, which means they may contain characters in various random
27  * encodings; this has been seen to cause encoding errors when reading the
28  * dump script. Think not to get around that by using %z, because
29  * (1) %z is not portable to pre-C99 systems, and
30  * (2) %z doesn't actually act differently from %Z on Windows anyway.
31  */
32 #ifndef WIN32
33 #define PGDUMP_STRFTIME_FMT "%Y-%m-%d %H:%M:%S %Z"
34 #else
35 #define PGDUMP_STRFTIME_FMT "%Y-%m-%d %H:%M:%S"
36 #endif
37 
38 
39 extern bool buildACLCommands(const char *name, const char *subname,
40  const char *type, const char *acls, const char *racls,
41  const char *owner, const char *prefix, int remoteVersion,
42  PQExpBuffer sql);
43 extern bool buildDefaultACLCommands(const char *type, const char *nspname,
44  const char *acls, const char *racls,
45  const char *initacls, const char *initracls,
46  const char *owner,
47  int remoteVersion,
48  PQExpBuffer sql);
49 extern void buildShSecLabelQuery(PGconn *conn, const char *catalog_name,
50  uint32 objectId, PQExpBuffer sql);
51 extern void emitShSecLabels(PGconn *conn, PGresult *res,
52  PQExpBuffer buffer, const char *target, const char *objname);
53 
54 extern void buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery,
55  PQExpBuffer init_acl_subquery, PQExpBuffer init_racl_subquery,
56  const char *acl_column, const char *acl_owner,
57  const char *obj_kind, bool binary_upgrade);
58 
59 #endif /* DUMPUTILS_H */
bool buildDefaultACLCommands(const char *type, const char *nspname, const char *acls, const char *racls, const char *initacls, const char *initracls, const char *owner, int remoteVersion, PQExpBuffer sql)
Definition: dumputils.c:366
void buildShSecLabelQuery(PGconn *conn, const char *catalog_name, uint32 objectId, PQExpBuffer sql)
Definition: dumputils.c:636
PGconn * conn
Definition: streamutil.c:42
unsigned int uint32
Definition: c.h:265
void buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery, PQExpBuffer init_acl_subquery, PQExpBuffer init_racl_subquery, const char *acl_column, const char *acl_owner, const char *obj_kind, bool binary_upgrade)
Definition: dumputils.c:688
void emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer, const char *target, const char *objname)
Definition: dumputils.c:652
const char * name
Definition: encode.c:521
static int binary_upgrade
Definition: pg_dumpall.c:67
bool buildACLCommands(const char *name, const char *subname, const char *type, const char *acls, const char *racls, const char *owner, const char *prefix, int remoteVersion, PQExpBuffer sql)
Definition: dumputils.c:55