Make pg_dump dump ACL's by default, print warning on use of -z, and add

new -x option to skip acl dump.
This commit is contained in:
Bruce Momjian 1999-05-27 16:29:05 +00:00
parent e53c51280b
commit 615e77ede2
7 changed files with 35 additions and 30 deletions

View File

@ -259,7 +259,7 @@ script from v6.0 or everything
To dump your fairly recent post-v6.0 database installation, type To dump your fairly recent post-v6.0 database installation, type
<programlisting> <programlisting>
$ pg_dumpall -z > db.out $ pg_dumpall > db.out
</programlisting> </programlisting>
</para> </para>
<para> <para>
@ -273,7 +273,7 @@ $ cd
$ gunzip -c postgresql-v6.5.tar.gz \ $ gunzip -c postgresql-v6.5.tar.gz \
| tar xvf - src/bin/pg_dump/pg_dumpall | tar xvf - src/bin/pg_dump/pg_dumpall
$ chmod a+x src/bin/pg_dump/pg_dumpall $ chmod a+x src/bin/pg_dump/pg_dumpall
$ src/bin/pg_dump/pg_dumpall -z > db.out $ src/bin/pg_dump/pg_dumpall > db.out
$ rm -rf src $ rm -rf src
</ProgramListing> </ProgramListing>
</Para> </Para>

View File

@ -22,7 +22,7 @@ pg_dump [ <replaceable class="parameter">dbname</replaceable> ]
pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -t <replaceable class="parameter">table</replaceable> ] [ -t <replaceable class="parameter">table</replaceable> ]
[ -f <replaceable class="parameter">outputfile</replaceable> ] [ -f <replaceable class="parameter">outputfile</replaceable> ]
[ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -o ] [ -s ] [ -u ] [ -v ] [ -z ] [ -a ] [ -c ] [ -d ] [ -D ] [ -n ] [ -N ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
[ <replaceable class="parameter">dbname</replaceable> ] [ <replaceable class="parameter">dbname</replaceable> ]
</SYNOPSIS> </SYNOPSIS>
@ -190,11 +190,11 @@ pg_dump [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceab
<varlistentry> <varlistentry>
<term> <term>
-z -x
</term> </term>
<listitem> <listitem>
<para> <para>
Include ACLs (grant/revoke commands) and table ownership information. Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -20,7 +20,7 @@ Extract all <productname>Postgres</productname> databases into a script file
<SYNOPSIS> <SYNOPSIS>
pg_dumpall pg_dumpall
pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ] pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
[ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -z ] [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
</SYNOPSIS> </SYNOPSIS>
<REFSECT2 ID="R2-APP-PG-DUMPALL-1"> <REFSECT2 ID="R2-APP-PG-DUMPALL-1">
@ -125,11 +125,11 @@ pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replac
<varlistentry> <varlistentry>
<term> <term>
-z -x
</term> </term>
<listitem> <listitem>
<para> <para>
Include ACLs (grant/revoke commands) and table ownership information. Prevent dumping ACLs (grant/revoke commands) and table ownership information.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -34,7 +34,7 @@ Description
PostgreSQL release without reloading all the data. First, PostgreSQL release without reloading all the data. First,
to be safe, back up your data directory. Then, use: to be safe, back up your data directory. Then, use:
<programlisting> <programlisting>
% pg_dumpall -s -z >db.out % pg_dumpall -s >db.out
</programlisting> </programlisting>
to dump out your old database definitions without any to dump out your old database definitions without any
data. Stop the postmaster and all backends. data. Stop the postmaster and all backends.

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.31 1999/05/26 21:51:13 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.32 1999/05/27 16:29:03 momjian Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
@ -232,7 +232,7 @@ TableInfo *
dumpSchema(FILE *fout, dumpSchema(FILE *fout,
int *numTablesPtr, int *numTablesPtr,
const char *tablename, const char *tablename,
const bool acls) const bool aclsSkip)
{ {
int numTypes; int numTypes;
int numFuncs; int numFuncs;
@ -301,7 +301,7 @@ dumpSchema(FILE *fout,
fprintf(stderr, "%s dumping out tables %s\n", fprintf(stderr, "%s dumping out tables %s\n",
g_comment_start, g_comment_end); g_comment_start, g_comment_end);
dumpTables(fout, tblinfo, numTables, inhinfo, numInherits, dumpTables(fout, tblinfo, numTables, inhinfo, numInherits,
tinfo, numTypes, tablename, acls); tinfo, numTypes, tablename, aclsSkip);
} }
if (!tablename && fout) if (!tablename && fout)

View File

@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.112 1999/05/26 21:51:12 tgl Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.113 1999/05/27 16:29:03 momjian Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
@ -116,7 +116,7 @@ bool dumpData; /* dump data using proper insert strings */
bool attrNames; /* put attr names into insert strings */ bool attrNames; /* put attr names into insert strings */
bool schemaOnly; bool schemaOnly;
bool dataOnly; bool dataOnly;
bool aclsOption; bool aclsSkip;
bool dropSchema; bool dropSchema;
char g_opaque_type[10]; /* name for the opaque type */ char g_opaque_type[10]; /* name for the opaque type */
@ -549,7 +549,7 @@ main(int argc, char **argv)
char tmp_string[128]; char tmp_string[128];
char username[100]; char username[100];
char password[100]; char password[100];
int use_password = 0; bool use_password = false;
g_verbose = false; g_verbose = false;
force_quotes = true; force_quotes = true;
@ -563,7 +563,7 @@ main(int argc, char **argv)
progname = *argv; progname = *argv;
while ((c = getopt(argc, argv, "acdDf:h:nNop:st:vzu")) != EOF) while ((c = getopt(argc, argv, "acdDf:h:nNop:st:uvxz")) != EOF)
{ {
switch (c) switch (c)
{ {
@ -630,14 +630,19 @@ main(int argc, char **argv)
} }
} }
break; break;
case 'u':
use_password = true;
break;
case 'v': /* verbose */ case 'v': /* verbose */
g_verbose = true; g_verbose = true;
break; break;
case 'z': /* Dump ACLs and table ownership info */ case 'x': /* skip ACL dump */
aclsOption = true; aclsSkip = true;
break; break;
case 'u': case 'z': /* Old ACL option bjm 1999/05/27 */
use_password = 1; fprintf(stderr,
"%s: The -z option(dump ACLs) is now the default, continuing.\n",
progname);
break; break;
default: default:
usage(progname); usage(progname);
@ -726,10 +731,10 @@ main(int argc, char **argv)
if (g_verbose) if (g_verbose)
fprintf(stderr, "%s last builtin oid is %u %s\n", fprintf(stderr, "%s last builtin oid is %u %s\n",
g_comment_start, g_last_builtin_oid, g_comment_end); g_comment_start, g_last_builtin_oid, g_comment_end);
tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsOption); tblinfo = dumpSchema(g_fout, &numTables, tablename, aclsSkip);
} }
else else
tblinfo = dumpSchema(NULL, &numTables, tablename, aclsOption); tblinfo = dumpSchema(NULL, &numTables, tablename, aclsSkip);
if (!schemaOnly) if (!schemaOnly)
dumpClasses(tblinfo, numTables, g_fout, tablename, oids); dumpClasses(tblinfo, numTables, g_fout, tablename, oids);
@ -2689,7 +2694,7 @@ void
dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
InhInfo *inhinfo, int numInherits, InhInfo *inhinfo, int numInherits,
TypeInfo *tinfo, int numTypes, const char *tablename, TypeInfo *tinfo, int numTypes, const char *tablename,
const bool acls) const bool aclsSkip)
{ {
int i, int i,
j, j,
@ -2723,7 +2728,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
{ {
becomeUser(fout, tblinfo[i].usename); becomeUser(fout, tblinfo[i].usename);
dumpSequence(fout, tblinfo[i]); dumpSequence(fout, tblinfo[i]);
if (acls) if (!aclsSkip)
dumpACL(fout, tblinfo[i]); dumpACL(fout, tblinfo[i]);
} }
} }
@ -2847,7 +2852,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
strcat(q, ";\n"); strcat(q, ";\n");
fputs(q, fout); fputs(q, fout);
if (acls) if (!aclsSkip)
dumpACL(fout, tblinfo[i]); dumpACL(fout, tblinfo[i]);
} }
@ -3380,7 +3385,7 @@ becomeUser(FILE *fout, const char *username)
{ {
static const char *lastusername = ""; static const char *lastusername = "";
if (!aclsOption) if (aclsSkip)
return; return;
if (strcmp(lastusername, username) == 0) if (strcmp(lastusername, username) == 0)

View File

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