PostgreSQL Source Code  git master
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-2024, 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, const char *nspname,
40  const char *type, const char *acls, const char *baseacls,
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 *acldefault,
45  const char *owner,
46  int remoteVersion,
47  PQExpBuffer sql);
48 
49 extern void quoteAclUserName(PQExpBuffer output, const char *input);
50 
51 extern void buildShSecLabelQuery(const char *catalog_name,
52  Oid objectId, PQExpBuffer sql);
53 extern void emitShSecLabels(PGconn *conn, PGresult *res,
54  PQExpBuffer buffer, const char *objtype, const char *objname);
55 
56 extern bool variable_is_guc_list_quote(const char *name);
57 
58 extern bool SplitGUCList(char *rawstring, char separator,
59  char ***namelist);
60 
61 extern void makeAlterConfigCommand(PGconn *conn, const char *configitem,
62  const char *type, const char *name,
63  const char *type2, const char *name2,
65 
66 #endif /* DUMPUTILS_H */
Acl * acldefault(ObjectType objtype, Oid ownerId)
Definition: acl.c:786
bool buildACLCommands(const char *name, const char *subname, const char *nspname, const char *type, const char *acls, const char *baseacls, const char *owner, const char *prefix, int remoteVersion, PQExpBuffer sql)
Definition: dumputils.c:64
void buildShSecLabelQuery(const char *catalog_name, Oid objectId, PQExpBuffer sql)
Definition: dumputils.c:637
void makeAlterConfigCommand(PGconn *conn, const char *configitem, const char *type, const char *name, const char *type2, const char *name2, PQExpBuffer buf)
Definition: dumputils.c:823
bool buildDefaultACLCommands(const char *type, const char *nspname, const char *acls, const char *acldefault, const char *owner, int remoteVersion, PQExpBuffer sql)
Definition: dumputils.c:326
bool variable_is_guc_list_quote(const char *name)
Definition: dumputils.c:689
void quoteAclUserName(PQExpBuffer output, const char *input)
Definition: dumputils.c:544
void emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer, const char *objtype, const char *objname)
Definition: dumputils.c:655
bool SplitGUCList(char *rawstring, char separator, char ***namelist)
Definition: dumputils.c:723
FILE * input
FILE * output
NameData subname
static char * buf
Definition: pg_test_fsync.c:73
unsigned int Oid
Definition: postgres_ext.h:31
PGconn * conn
Definition: streamutil.c:55
const char * type
const char * name