Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6cbdbd9

Browse files
committed
Add extra descriptive headings in pg_dumpall
Headings are added for the User Configurations and Databases sections,and for each user configuration and database in the output.Author: Fabien CoelhoDiscussion:https://postgr.es/m/alpine.DEB.2.21.1812272222130.32444@lancre
1 parentf092de0 commit6cbdbd9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,7 @@ dumpUserConfig(PGconn *conn, const char *username)
13461346
{
13471347
PQExpBufferbuf=createPQExpBuffer();
13481348
intcount=1;
1349+
boolfirst= true;
13491350

13501351
for (;;)
13511352
{
@@ -1367,6 +1368,14 @@ dumpUserConfig(PGconn *conn, const char *username)
13671368
if (PQntuples(res)==1&&
13681369
!PQgetisnull(res,0,0))
13691370
{
1371+
/* comment at section start, only if needed */
1372+
if (first)
1373+
{
1374+
fprintf(OPF,"--\n-- User Configurations\n--\n\n");
1375+
first= false;
1376+
}
1377+
1378+
fprintf(OPF,"--\n-- User Config \"%s\"\n--\n\n",username);
13701379
resetPQExpBuffer(buf);
13711380
makeAlterConfigCommand(conn,PQgetvalue(res,0,0),
13721381
"ROLE",username,NULL,NULL,
@@ -1454,6 +1463,9 @@ dumpDatabases(PGconn *conn)
14541463
"WHERE datallowconn "
14551464
"ORDER BY (datname <> 'template1'), datname");
14561465

1466+
if (PQntuples(res)>0)
1467+
fprintf(OPF,"--\n-- Databases\n--\n\n");
1468+
14571469
for (i=0;i<PQntuples(res);i++)
14581470
{
14591471
char*dbname=PQgetvalue(res,i,0);
@@ -1476,6 +1488,8 @@ dumpDatabases(PGconn *conn)
14761488
if (verbose)
14771489
fprintf(stderr,_("%s: dumping database \"%s\"...\n"),progname,dbname);
14781490

1491+
fprintf(OPF,"--\n-- Database \"%s\" dump\n--\n\n",dbname);
1492+
14791493
/*
14801494
* We assume that "template1" and "postgres" already exist in the
14811495
* target installation. dropDBs() won't have removed them, for fear

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp