Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 615e77e

Browse files
committed
Make pg_dump dump ACL's by default, print warning on use of -z, and add
new -x option to skip acl dump.
1 parent e53c512 commit 615e77e

File tree

7 files changed

+35
-30
lines changed

7 files changed

+35
-30
lines changed

doc/src/sgml/install.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ script from v6.0 or everything
259259
To dump your fairly recent post-v6.0 database installation, type
260260

261261
<programlisting>
262-
$ pg_dumpall -z > db.out
262+
$ pg_dumpall > db.out
263263
</programlisting>
264264
</para>
265265
<para>
@@ -273,7 +273,7 @@ $ cd
273273
$ gunzip -c postgresql-v6.5.tar.gz \
274274
| tar xvf - src/bin/pg_dump/pg_dumpall
275275
$ chmod a+x src/bin/pg_dump/pg_dumpall
276-
$ src/bin/pg_dump/pg_dumpall -z > db.out
276+
$ src/bin/pg_dump/pg_dumpall > db.out
277277
$ rm -rf src
278278
</ProgramListing>
279279
</Para>

doc/src/sgml/ref/pg_dump.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
2222
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
2323
[ -t <replaceable class="parameter">table</replaceable> ]
2424
[ -f <replaceable class="parameter">outputfile</replaceable> ]
25-
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -o ] [ -s ] [ -u ] [ -v ] [ -z ]
25+
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
2626
[ <replaceable class="parameter">dbname</replaceable> ]
2727
</SYNOPSIS>
2828

@@ -190,11 +190,11 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
190190

191191
<varlistentry>
192192
<term>
193-
-z
193+
-x
194194
</term>
195195
<listitem>
196196
<para>
197-
Include ACLs (grant/revoke commands) and table ownership information.
197+
Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
198198
</para>
199199
</listitem>
200200
</varlistentry>

doc/src/sgml/ref/pg_dumpall.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Extract all <productname>Postgres</productname> databases into a script file
2020
<SYNOPSIS>
2121
pg_dumpall
2222
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
23-
[ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -z ]
23+
[ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
2424
</SYNOPSIS>
2525

2626
<REFSECT2 ID="R2-APP-PG-DUMPALL-1">
@@ -125,11 +125,11 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
125125

126126
<varlistentry>
127127
<term>
128-
-z
128+
-x
129129
</term>
130130
<listitem>
131131
<para>
132-
Include ACLs (grant/revoke commands) and table ownership information.
132+
Prevent dumping ACLs (grant/revoke commands) and table ownership information.
133133
</para>
134134
</listitem>
135135
</varlistentry>

doc/src/sgml/ref/pg_upgrade.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Description
3434
PostgreSQL release without reloading all the data. First,
3535
to be safe, back up your data directory. Then, use:
3636
<programlisting>
37-
% pg_dumpall -s -z >db.out
37+
% pg_dumpall -s >db.out
3838
</programlisting>
3939
to dump out your old database definitions without any
4040
data. Stop the postmaster and all backends.

src/bin/pg_dump/common.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.31 1999/05/26 21:51:13 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.32 1999/05/27 16:29:03 momjian Exp $
1111
*
1212
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
1313
*
@@ -232,7 +232,7 @@ TableInfo *
232232
dumpSchema(FILE *fout,
233233
int *numTablesPtr,
234234
const char *tablename,
235-
const bool acls)
235+
const bool aclsSkip)
236236
{
237237
int numTypes;
238238
int numFuncs;
@@ -301,7 +301,7 @@ dumpSchema(FILE *fout,
301301
fprintf(stderr, "%s dumping out tables %s\n",
302302
g_comment_start, g_comment_end);
303303
dumpTables(fout, tblinfo, numTables, inhinfo, numInherits,
304-
tinfo, numTypes, tablename, acls);
304+
tinfo, numTypes, tablename, aclsSkip);
305305
}
306306

307307
if (!tablename && fout)

src/bin/pg_dump/pg_dump.c

+19-14
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.112 1999/05/26 21:51:12 tgl Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.113 1999/05/27 16:29:03 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -116,7 +116,7 @@ bool dumpData; /* dump data using proper insert strings */
116116
bool attrNames; /* put attr names into insert strings */
117117
bool schemaOnly;
118118
bool dataOnly;
119-
bool aclsOption;
119+
bool aclsSkip;
120120
bool dropSchema;
121121

122122
char g_opaque_type[10]; /* name for the opaque type */
@@ -549,7 +549,7 @@ main(int argc, char **argv)
549549
char tmp_string[128];
550550
char username[100];
551551
char password[100];
552-
int use_password = 0;
552+
bool use_password = false;
553553

554554
g_verbose = false;
555555
force_quotes = true;
@@ -563,7 +563,7 @@ main(int argc, char **argv)
563563

564564
progname = *argv;
565565

566-
while ((c = getopt(argc, argv, "acdDf:h:nNop:st:vzu")) != EOF)
566+
while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxz")) != EOF)
567567
{
568568
switch (c)
569569
{
@@ -630,14 +630,19 @@ main(int argc, char **argv)
630630
}
631631
}
632632
break;
633+
case 'u':
634+
use_password = true;
635+
break;
633636
case 'v': /* verbose */
634637
g_verbose = true;
635638
break;
636-
case 'z': /* Dump ACLs and table ownership info */
637-
aclsOption = true;
639+
case 'x': /* skip ACL dump */
640+
aclsSkip = true;
638641
break;
639-
case 'u':
640-
use_password = 1;
642+
case 'z': /* Old ACL option bjm 1999/05/27 */
643+
fprintf(stderr,
644+
"%s: The -z option(dump ACLs) is now the default, continuing.\n",
645+
progname);
641646
break;
642647
default:
643648
usage(progname);
@@ -726,10 +731,10 @@ main(int argc, char **argv)
726731
if (g_verbose)
727732
fprintf(stderr, "%s last builtin oid is %u %s\n",
728733
g_comment_start, g_last_builtin_oid, g_comment_end);
729-
tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsOption);
734+
tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsSkip);
730735
}
731736
else
732-
tblinfo = dumpSchema(NULL, &numTables, tablename, aclsOption);
737+
tblinfo = dumpSchema(NULL, &numTables, tablename, aclsSkip);
733738

734739
if (!schemaOnly)
735740
dumpClasses(tblinfo, numTables, g_fout, tablename, oids);
@@ -2689,7 +2694,7 @@ void
26892694
dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
26902695
InhInfo *inhinfo, int numInherits,
26912696
TypeInfo *tinfo, int numTypes, const char *tablename,
2692-
const bool acls)
2697+
const bool aclsSkip)
26932698
{
26942699
int i,
26952700
j,
@@ -2723,7 +2728,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
27232728
{
27242729
becomeUser(fout, tblinfo[i].usename);
27252730
dumpSequence(fout, tblinfo[i]);
2726-
if (acls)
2731+
if (!aclsSkip)
27272732
dumpACL(fout, tblinfo[i]);
27282733
}
27292734
}
@@ -2847,7 +2852,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
28472852

28482853
strcat(q, ";\n");
28492854
fputs(q, fout);
2850-
if (acls)
2855+
if (!aclsSkip)
28512856
dumpACL(fout, tblinfo[i]);
28522857

28532858
}
@@ -3380,7 +3385,7 @@ becomeUser(FILE *fout, const char *username)
33803385
{
33813386
static const char *lastusername = "";
33823387

3383-
if (!aclsOption)
3388+
if (aclsSkip)
33843389
return;
33853390

33863391
if (strcmp(lastusername, username) == 0)

src/man/pg_dump.1

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.16 1999/01/21 22:53:37 momjian Exp $
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/pg_dump.1,v 1.17 1999/05/27 16:29:05 momjian Exp $
44
.TH PG_DUMP UNIX 7/15/98 PostgreSQL PostgreSQL
55
.SH NAME
66
pg_dump - dumps out a Postgres database into a script file
@@ -48,7 +48,7 @@ table]
4848
.BR "-v"
4949
]
5050
[\c
51-
.BR "-z"
51+
.BR "-x"
5252
]
5353
dbname
5454
.in -5n
@@ -113,8 +113,8 @@ Use password authentication. Prompts for username and password
113113
.BR "-v" ""
114114
Specifies verbose mode
115115
.TP
116-
.BR "-z" ""
117-
Include ACLs (grant/revoke commands) and table ownership information
116+
.BR "-x" ""
117+
Prevent dumping of ACLs (grant/revoke commands) and table ownership information
118118
.PP
119119
If dbname is not supplied, then the DATABASE environment variable value is used.
120120
.SH "CAVEATS AND LIMITATIONS"

0 commit comments

Comments
 (0)