Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

PostgreSQL Source Code git master
dumputils.h File Reference
#include "libpq-fe.h"
#include "pqexpbuffer.h"
Include dependency graph for dumputils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PGDUMP_STRFTIME_FMT   "%Y-%m-%d %H:%M:%S %Z"
 

Functions

char * sanitize_line (const char *str, bool want_hyphen)
 
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)
 
bool buildDefaultACLCommands (const char *type, const char *nspname, const char *acls, const char *acldefault, const char *owner, int remoteVersion, PQExpBuffer sql)
 
void quoteAclUserName (PQExpBuffer output, const char *input)
 
void buildShSecLabelQuery (const char *catalog_name, Oid objectId, PQExpBuffer sql)
 
void emitShSecLabels (PGconn *conn, PGresult *res, PQExpBuffer buffer, const char *objtype, const char *objname)
 
bool variable_is_guc_list_quote (const char *name)
 
bool SplitGUCList (char *rawstring, char separator, char ***namelist)
 
void makeAlterConfigCommand (PGconn *conn, const char *configitem, const char *type, const char *name, const char *type2, const char *name2, PQExpBuffer buf)
 
void create_or_open_dir (const char *dirname)
 
char * generate_restrict_key (void)
 
bool valid_restrict_key (const char *restrict_key)
 

Macro Definition Documentation

◆ PGDUMP_STRFTIME_FMT

#define PGDUMP_STRFTIME_FMT   "%Y-%m-%d %H:%M:%S %Z"

Definition at line 33 of file dumputils.h.

Function Documentation

◆ buildACLCommands()

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 at line 104 of file dumputils.c.

108{
109 bool ok = true;
110 char **aclitems = NULL;
111 char **baseitems = NULL;
112 char **grantitems = NULL;
113 char **revokeitems = NULL;
114 int naclitems = 0;
115 int nbaseitems = 0;
116 int ngrantitems = 0;
117 int nrevokeitems = 0;
118 int i;
119 PQExpBuffer grantee,
120 grantor,
121 privs,
122 privswgo;
123 PQExpBuffer firstsql,
124 secondsql;
125
126 /*
127 * If the acl was NULL (initial default state), we need do nothing. Note
128 * that this is distinguishable from all-privileges-revoked, which will
129 * look like an empty array ("{}").
130 */
131 if (acls == NULL || *acls == '\0')
132 return true; /* object has default permissions */
133
134 /* treat empty-string owner same as NULL */
135 if (owner && *owner == '\0')
136 owner = NULL;
137
138 /* Parse the acls array */
139 if (!parsePGArray(acls, &aclitems, &naclitems))
140 {
141 free(aclitems);
142 return false;
143 }
144
145 /* Parse the baseacls too */
146 if (!parsePGArray(baseacls, &baseitems, &nbaseitems))
147 {
148 free(aclitems);
149 free(baseitems);
150 return false;
151 }
152
153 /*
154 * Compare the actual ACL with the base ACL, extracting the privileges
155 * that need to be granted (i.e., are in the actual ACL but not the base
156 * ACL) and the ones that need to be revoked (the reverse). We use plain
157 * string comparisons to check for matches. In principle that could be
158 * fooled by extraneous issues such as whitespace, but since all these
159 * strings are the work of aclitemout(), it should be OK in practice.
160 * Besides, a false mismatch will just cause the output to be a little
161 * more verbose than it really needed to be.
162 */
163 grantitems = (char **) pg_malloc(naclitems * sizeof(char *));
164 for (i = 0; i < naclitems; i++)
165 {
166 bool found = false;
167
168 for (int j = 0; j < nbaseitems; j++)
169 {
170 if (strcmp(aclitems[i], baseitems[j]) == 0)
171 {
172 found = true;
173 break;
174 }
175 }
176 if (!found)
177 grantitems[ngrantitems++] = aclitems[i];
178 }
179 revokeitems = (char **) pg_malloc(nbaseitems * sizeof(char *));
180 for (i = 0; i < nbaseitems; i++)
181 {
182 bool found = false;
183
184 for (int j = 0; j < naclitems; j++)
185 {
186 if (strcmp(baseitems[i], aclitems[j]) == 0)
187 {
188 found = true;
189 break;
190 }
191 }
192 if (!found)
193 revokeitems[nrevokeitems++] = baseitems[i];
194 }
195
196 /* Prepare working buffers */
197 grantee = createPQExpBuffer();
198 grantor = createPQExpBuffer();
199 privs = createPQExpBuffer();
200 privswgo = createPQExpBuffer();
201
202 /*
203 * At the end, these two will be pasted together to form the result.
204 */
205 firstsql = createPQExpBuffer();
206 secondsql = createPQExpBuffer();
207
208 /*
209 * Build REVOKE statements for ACLs listed in revokeitems[].
210 */
211 for (i = 0; i < nrevokeitems; i++)
212 {
213 if (!parseAclItem(revokeitems[i],
214 type, name, subname, remoteVersion,
215 grantee, grantor, privs, NULL))
216 {
217 ok = false;
218 break;
219 }
220
221 if (privs->len > 0)
222 {
223 appendPQExpBuffer(firstsql, "%sREVOKE %s ON %s ",
224 prefix, privs->data, type);
225 if (nspname && *nspname)
226 appendPQExpBuffer(firstsql, "%s.", fmtId(nspname));
227 if (name && *name)
228 appendPQExpBuffer(firstsql, "%s ", name);
229 appendPQExpBufferStr(firstsql, "FROM ");
230 if (grantee->len == 0)
231 appendPQExpBufferStr(firstsql, "PUBLIC;\n");
232 else
233 appendPQExpBuffer(firstsql, "%s;\n",
234 fmtId(grantee->data));
235 }
236 }
237
238 /*
239 * At this point we have issued REVOKE statements for all initial and
240 * default privileges that are no longer present on the object, so we are
241 * almost ready to GRANT the privileges listed in grantitems[].
242 *
243 * We still need some hacking though to cover the case where new default
244 * public privileges are added in new versions: the REVOKE ALL will revoke
245 * them, leading to behavior different from what the old version had,
246 * which is generally not what's wanted. So add back default privs if the
247 * source database is too old to have had that particular priv. (As of
248 * right now, no such cases exist in supported versions.)
249 */
250
251 /*
252 * Scan individual ACL items to be granted.
253 *
254 * The order in which privileges appear in the ACL string (the order they
255 * have been GRANT'd in, which the backend maintains) must be preserved to
256 * ensure that GRANTs WITH GRANT OPTION and subsequent GRANTs based on
257 * those are dumped in the correct order. However, some old server
258 * versions will show grants to PUBLIC before the owner's own grants; for
259 * consistency's sake, force the owner's grants to be output first.
260 */
261 for (i = 0; i < ngrantitems; i++)
262 {
263 if (parseAclItem(grantitems[i], type, name, subname, remoteVersion,
264 grantee, grantor, privs, privswgo))
265 {
266 /*
267 * If the grantor isn't the owner, we'll need to use SET SESSION
268 * AUTHORIZATION to become the grantor. Issue the SET/RESET only
269 * if there's something useful to do.
270 */
271 if (privs->len > 0 || privswgo->len > 0)
272 {
273 PQExpBuffer thissql;
274
275 /* Set owner as grantor if that's not explicit in the ACL */
276 if (grantor->len == 0 && owner)
277 printfPQExpBuffer(grantor, "%s", owner);
278
279 /* Make sure owner's own grants are output before others */
280 if (owner &&
281 strcmp(grantee->data, owner) == 0 &&
282 strcmp(grantor->data, owner) == 0)
283 thissql = firstsql;
284 else
285 thissql = secondsql;
286
287 if (grantor->len > 0
288 && (!owner || strcmp(owner, grantor->data) != 0))
289 appendPQExpBuffer(thissql, "SET SESSION AUTHORIZATION %s;\n",
290 fmtId(grantor->data));
291
292 if (privs->len > 0)
293 {
294 appendPQExpBuffer(thissql, "%sGRANT %s ON %s ",
295 prefix, privs->data, type);
296 if (nspname && *nspname)
297 appendPQExpBuffer(thissql, "%s.", fmtId(nspname));
298 if (name && *name)
299 appendPQExpBuffer(thissql, "%s ", name);
300 appendPQExpBufferStr(thissql, "TO ");
301 if (grantee->len == 0)
302 appendPQExpBufferStr(thissql, "PUBLIC;\n");
303 else
304 appendPQExpBuffer(thissql, "%s;\n", fmtId(grantee->data));
305 }
306 if (privswgo->len > 0)
307 {
308 appendPQExpBuffer(thissql, "%sGRANT %s ON %s ",
309 prefix, privswgo->data, type);
310 if (nspname && *nspname)
311 appendPQExpBuffer(thissql, "%s.", fmtId(nspname));
312 if (name && *name)
313 appendPQExpBuffer(thissql, "%s ", name);
314 appendPQExpBufferStr(thissql, "TO ");
315 if (grantee->len == 0)
316 appendPQExpBufferStr(thissql, "PUBLIC");
317 else
318 appendPQExpBufferStr(thissql, fmtId(grantee->data));
319 appendPQExpBufferStr(thissql, " WITH GRANT OPTION;\n");
320 }
321
322 if (grantor->len > 0
323 && (!owner || strcmp(owner, grantor->data) != 0))
324 appendPQExpBufferStr(thissql, "RESET SESSION AUTHORIZATION;\n");
325 }
326 }
327 else
328 {
329 /* parseAclItem failed, give up */
330 ok = false;
331 break;
332 }
333 }
334
335 destroyPQExpBuffer(grantee);
336 destroyPQExpBuffer(grantor);
337 destroyPQExpBuffer(privs);
338 destroyPQExpBuffer(privswgo);
339
340 appendPQExpBuffer(sql, "%s%s", firstsql->data, secondsql->data);
341 destroyPQExpBuffer(firstsql);
342 destroyPQExpBuffer(secondsql);
343
344 free(aclitems);
345 free(baseitems);
346 free(grantitems);
347 free(revokeitems);
348
349 return ok;
350}
static bool parseAclItem(const char *item, const char *type, const char *name, const char *subname, int remoteVersion, PQExpBuffer grantee, PQExpBuffer grantor, PQExpBuffer privs, PQExpBuffer privswgo)
Definition: dumputils.c:423
void * pg_malloc(size_t size)
Definition: fe_memutils.c:47
#define free(a)
Definition: header.h:65
int j
Definition: isn.c:78
int i
Definition: isn.c:77
NameData subname
void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
Definition: pqexpbuffer.c:235
PQExpBuffer createPQExpBuffer(void)
Definition: pqexpbuffer.c:72
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
Definition: pqexpbuffer.c:265
void destroyPQExpBuffer(PQExpBuffer str)
Definition: pqexpbuffer.c:114
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
Definition: pqexpbuffer.c:367
const char * fmtId(const char *rawid)
Definition: string_utils.c:248
bool parsePGArray(const char *atext, char ***itemarray, int *nitems)
Definition: string_utils.c:819
const char * type
const char * name

References appendPQExpBuffer(), appendPQExpBufferStr(), createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), free, i, j, PQExpBufferData::len, name, parseAclItem(), parsePGArray(), pg_malloc(), printfPQExpBuffer(), subname, and type.

Referenced by buildDefaultACLCommands(), dumpACL(), dumpRoleGUCPrivs(), and dumpTablespaces().

◆ buildDefaultACLCommands()

bool buildDefaultACLCommands ( const char *  type,
const char *  nspname,
const char *  acls,
const char *  acldefault,
const char *  owner,
int  remoteVersion,
PQExpBuffer  sql 
)

Definition at line 366 of file dumputils.c.

371{
372 PQExpBuffer prefix;
373
374 prefix = createPQExpBuffer();
375
376 /*
377 * We incorporate the target role directly into the command, rather than
378 * playing around with SET ROLE or anything like that. This is so that a
379 * permissions error leads to nothing happening, rather than changing
380 * default privileges for the wrong user.
381 */
382 appendPQExpBuffer(prefix, "ALTER DEFAULT PRIVILEGES FOR ROLE %s ",
383 fmtId(owner));
384 if (nspname)
385 appendPQExpBuffer(prefix, "IN SCHEMA %s ", fmtId(nspname));
386
387 /*
388 * There's no such thing as initprivs for a default ACL, so the base ACL
389 * is always just the object-type-specific default.
390 */
391 if (!buildACLCommands("", NULL, NULL, type,
392 acls, acldefault, owner,
393 prefix->data, remoteVersion, sql))
394 {
395 destroyPQExpBuffer(prefix);
396 return false;
397 }
398
399 destroyPQExpBuffer(prefix);
400
401 return true;
402}
Acl * acldefault(ObjectType objtype, Oid ownerId)
Definition: acl.c:803
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:104

References acldefault(), appendPQExpBuffer(), buildACLCommands(), createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), fmtId(), and type.

Referenced by dumpDefaultACL().

◆ buildShSecLabelQuery()

void buildShSecLabelQuery ( const char *  catalog_name,
Oid  objectId,
PQExpBuffer  sql 
)

Definition at line 678 of file dumputils.c.

680{
682 "SELECT provider, label FROM pg_catalog.pg_shseclabel "
683 "WHERE classoid = 'pg_catalog.%s'::pg_catalog.regclass "
684 "AND objoid = '%u'", catalog_name, objectId);
685}

References appendPQExpBuffer().

Referenced by buildShSecLabels(), and dumpDatabase().

◆ create_or_open_dir()

void create_or_open_dir ( const char *  dirname)

Definition at line 935 of file dumputils.c.

936{
937 int ret;
938
939 switch ((ret = pg_check_dir(dirname)))
940 {
941 case -1:
942 /* opendir failed but not with ENOENT */
943 pg_fatal("could not open directory \"%s\": %m", dirname);
944 break;
945 case 0:
946 /* directory does not exist */
947 if (mkdir(dirname, pg_dir_create_mode) < 0)
948 pg_fatal("could not create directory \"%s\": %m", dirname);
949 break;
950 case 1:
951 /* exists and is empty, fix perms */
952 if (chmod(dirname, pg_dir_create_mode) != 0)
953 pg_fatal("could not change permissions of directory \"%s\": %m",
954 dirname);
955 break;
956 default:
957 /* exists and is not empty */
958 pg_fatal("directory \"%s\" is not empty", dirname);
959 }
960}
int pg_dir_create_mode
Definition: file_perm.c:18
#define pg_fatal(...)
int pg_check_dir(const char *dir)
Definition: pgcheckdir.c:33
#define mkdir(a, b)
Definition: win32_port.h:80

References mkdir, pg_check_dir(), pg_dir_create_mode, and pg_fatal.

Referenced by InitArchiveFmt_Directory().

◆ emitShSecLabels()

void emitShSecLabels ( PGconn conn,
PGresult res,
PQExpBuffer  buffer,
const char *  objtype,
const char *  objname 
)

Definition at line 696 of file dumputils.c.

698{
699 int i;
700
701 for (i = 0; i < PQntuples(res); i++)
702 {
703 char *provider = PQgetvalue(res, i, 0);
704 char *label = PQgetvalue(res, i, 1);
705
706 /* must use fmtId result before calling it again */
707 appendPQExpBuffer(buffer,
708 "SECURITY LABEL FOR %s ON %s",
709 fmtId(provider), objtype);
710 appendPQExpBuffer(buffer,
711 " %s IS ",
712 fmtId(objname));
714 appendPQExpBufferStr(buffer, ";\n");
715 }
716}
#define PQgetvalue
Definition: libpq-be-fe.h:253
#define PQntuples
Definition: libpq-be-fe.h:251
static char * label
PGconn * conn
Definition: streamutil.c:52
void appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
Definition: string_utils.c:446

References appendPQExpBuffer(), appendPQExpBufferStr(), appendStringLiteralConn(), conn, fmtId(), i, label, PQgetvalue, and PQntuples.

Referenced by buildShSecLabels(), and dumpDatabase().

◆ generate_restrict_key()

char * generate_restrict_key ( void  )

Definition at line 968 of file dumputils.c.

969{
970 uint8 buf[64];
971 char *ret = palloc(sizeof(buf));
972
973 if (!pg_strong_random(buf, sizeof(buf)))
974 return NULL;
975
976 for (int i = 0; i < sizeof(buf) - 1; i++)
977 {
978 uint8 idx = buf[i] % strlen(restrict_chars);
979
980 ret[i] = restrict_chars[idx];
981 }
982 ret[sizeof(buf) - 1] = '\0';
983
984 return ret;
985}
Datum idx(PG_FUNCTION_ARGS)
Definition: _int_op.c:262
uint8_t uint8
Definition: c.h:537
static const char restrict_chars[]
Definition: dumputils.c:24
void * palloc(Size size)
Definition: mcxt.c:1365
static char * buf
Definition: pg_test_fsync.c:72
bool pg_strong_random(void *buf, size_t len)

References buf, i, idx(), palloc(), pg_strong_random(), and restrict_chars.

Referenced by main().

◆ makeAlterConfigCommand()

void makeAlterConfigCommand ( PGconn conn,
const char *  configitem,
const char *  type,
const char *  name,
const char *  type2,
const char *  name2,
PQExpBuffer  buf 
)

Definition at line 864 of file dumputils.c.

868{
869 char *mine;
870 char *pos;
871
872 /* Parse the configitem. If we can't find an "=", silently do nothing. */
873 mine = pg_strdup(configitem);
874 pos = strchr(mine, '=');
875 if (pos == NULL)
876 {
877 pg_free(mine);
878 return;
879 }
880 *pos++ = '\0';
881
882 /* Build the command, with suitable quoting for everything. */
883 appendPQExpBuffer(buf, "ALTER %s %s ", type, fmtId(name));
884 if (type2 != NULL && name2 != NULL)
885 appendPQExpBuffer(buf, "IN %s %s ", type2, fmtId(name2));
886 appendPQExpBuffer(buf, "SET %s TO ", fmtId(mine));
887
888 /*
889 * Variables that are marked GUC_LIST_QUOTE were already fully quoted by
890 * flatten_set_variable_args() before they were put into the setconfig
891 * array. However, because the quoting rules used there aren't exactly
892 * like SQL's, we have to break the list value apart and then quote the
893 * elements as string literals. (The elements may be double-quoted as-is,
894 * but we can't just feed them to the SQL parser; it would do the wrong
895 * thing with elements that are zero-length or longer than NAMEDATALEN.)
896 *
897 * Variables that are not so marked should just be emitted as simple
898 * string literals. If the variable is not known to
899 * variable_is_guc_list_quote(), we'll do that; this makes it unsafe to
900 * use GUC_LIST_QUOTE for extension variables.
901 */
903 {
904 char **namelist;
905 char **nameptr;
906
907 /* Parse string into list of identifiers */
908 /* this shouldn't fail really */
909 if (SplitGUCList(pos, ',', &namelist))
910 {
911 for (nameptr = namelist; *nameptr; nameptr++)
912 {
913 if (nameptr != namelist)
915 appendStringLiteralConn(buf, *nameptr, conn);
916 }
917 }
918 pg_free(namelist);
919 }
920 else
922
924
925 pg_free(mine);
926}
bool variable_is_guc_list_quote(const char *name)
Definition: dumputils.c:730
bool SplitGUCList(char *rawstring, char separator, char ***namelist)
Definition: dumputils.c:764
char * pg_strdup(const char *in)
Definition: fe_memutils.c:85
void pg_free(void *ptr)
Definition: fe_memutils.c:105

References appendPQExpBuffer(), appendPQExpBufferStr(), appendStringLiteralConn(), buf, conn, fmtId(), name, pg_free(), pg_strdup(), SplitGUCList(), type, and variable_is_guc_list_quote().

Referenced by dumpDatabaseConfig(), and dumpUserConfig().

◆ quoteAclUserName()

void quoteAclUserName ( PQExpBuffer  output,
const char *  input 
)

Definition at line 585 of file dumputils.c.

586{
587 const char *src;
588 bool safe = true;
589
590 for (src = input; *src; src++)
591 {
592 /* This test had better match what putid() does */
593 if (!isalnum((unsigned char) *src) && *src != '_')
594 {
595 safe = false;
596 break;
597 }
598 }
599 if (!safe)
601 for (src = input; *src; src++)
602 {
603 /* A double quote character in a username is encoded as "" */
604 if (*src == '"')
607 }
608 if (!safe)
610}
FILE * input
FILE * output
void appendPQExpBufferChar(PQExpBuffer str, char ch)
Definition: pqexpbuffer.c:378

References appendPQExpBufferChar(), input, and output.

Referenced by getNamespaces().

◆ sanitize_line()

char * sanitize_line ( const char *  str,
bool  want_hyphen 
)

Definition at line 52 of file dumputils.c.

53{
54 char *result;
55 char *s;
56
57 if (!str)
58 return pg_strdup(want_hyphen ? "-" : "");
59
60 result = pg_strdup(str);
61
62 for (s = result; *s != '\0'; s++)
63 {
64 if (*s == '\n' || *s == '\r')
65 *s = ' ';
66 }
67
68 return result;
69}
const char * str

References pg_strdup(), and str.

Referenced by _printTocEntry(), dumpDatabases(), dumpTableData(), dumpUserConfig(), and PrintTOCSummary().

◆ SplitGUCList()

bool SplitGUCList ( char *  rawstring,
char  separator,
char ***  namelist 
)

Definition at line 764 of file dumputils.c.

766{
767 char *nextp = rawstring;
768 bool done = false;
769 char **nextptr;
770
771 /*
772 * Since we disallow empty identifiers, this is a conservative
773 * overestimate of the number of pointers we could need. Allow one for
774 * list terminator.
775 */
776 *namelist = nextptr = (char **)
777 pg_malloc((strlen(rawstring) / 2 + 2) * sizeof(char *));
778 *nextptr = NULL;
779
780 while (isspace((unsigned char) *nextp))
781 nextp++; /* skip leading whitespace */
782
783 if (*nextp == '\0')
784 return true; /* allow empty string */
785
786 /* At the top of the loop, we are at start of a new identifier. */
787 do
788 {
789 char *curname;
790 char *endp;
791
792 if (*nextp == '"')
793 {
794 /* Quoted name --- collapse quote-quote pairs */
795 curname = nextp + 1;
796 for (;;)
797 {
798 endp = strchr(nextp + 1, '"');
799 if (endp == NULL)
800 return false; /* mismatched quotes */
801 if (endp[1] != '"')
802 break; /* found end of quoted name */
803 /* Collapse adjacent quotes into one quote, and look again */
804 memmove(endp, endp + 1, strlen(endp));
805 nextp = endp;
806 }
807 /* endp now points at the terminating quote */
808 nextp = endp + 1;
809 }
810 else
811 {
812 /* Unquoted name --- extends to separator or whitespace */
813 curname = nextp;
814 while (*nextp && *nextp != separator &&
815 !isspace((unsigned char) *nextp))
816 nextp++;
817 endp = nextp;
818 if (curname == nextp)
819 return false; /* empty unquoted name not allowed */
820 }
821
822 while (isspace((unsigned char) *nextp))
823 nextp++; /* skip trailing whitespace */
824
825 if (*nextp == separator)
826 {
827 nextp++;
828 while (isspace((unsigned char) *nextp))
829 nextp++; /* skip leading whitespace for next */
830 /* we expect another name, so done remains false */
831 }
832 else if (*nextp == '\0')
833 done = true;
834 else
835 return false; /* invalid syntax */
836
837 /* Now safe to overwrite separator with a null */
838 *endp = '\0';
839
840 /*
841 * Finished isolating current name --- add it to output array
842 */
843 *nextptr++ = curname;
844
845 /* Loop back if we didn't reach end of string */
846 } while (!done);
847
848 *nextptr = NULL;
849 return true;
850}

References pg_malloc().

Referenced by makeAlterConfigCommand().

◆ valid_restrict_key()

bool valid_restrict_key ( const char *  restrict_key)

Definition at line 992 of file dumputils.c.

993{
994 return restrict_key != NULL &&
995 restrict_key[0] != '\0' &&
996 strspn(restrict_key, restrict_chars) == strlen(restrict_key);
997}
static char * restrict_key
Definition: pg_dumpall.c:125

References restrict_chars, and restrict_key.

Referenced by main().

◆ variable_is_guc_list_quote()

bool variable_is_guc_list_quote ( const char *  name)

Definition at line 730 of file dumputils.c.

731{
732 if (pg_strcasecmp(name, "local_preload_libraries") == 0 ||
733 pg_strcasecmp(name, "search_path") == 0 ||
734 pg_strcasecmp(name, "session_preload_libraries") == 0 ||
735 pg_strcasecmp(name, "shared_preload_libraries") == 0 ||
736 pg_strcasecmp(name, "temp_tablespaces") == 0 ||
737 pg_strcasecmp(name, "unix_socket_directories") == 0)
738 return true;
739 else
740 return false;
741}
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36

References name, and pg_strcasecmp().

Referenced by dumpFunc(), and makeAlterConfigCommand().