Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9e1e72b6
Commit
9e1e72b6
authored
21 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Cause pg_dumpall to support the -a, -s, -x options of pg_dump.
parent
df1df6bb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/ref/pg_dumpall.sgml
+36
-4
36 additions, 4 deletions
doc/src/sgml/ref/pg_dumpall.sgml
src/bin/pg_dump/pg_dumpall.c
+40
-11
40 additions, 11 deletions
src/bin/pg_dump/pg_dumpall.c
with
76 additions
and
15 deletions
doc/src/sgml/ref/pg_dumpall.sgml
+
36
−
4
View file @
9e1e72b6
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.3
8
2003/0
3/24 14:32:51 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.3
9
2003/0
5/30 23:55:10 tgl
Exp $
PostgreSQL documentation
-->
...
...
@@ -35,8 +35,8 @@ PostgreSQL documentation
<application>pg_dumpall</application> also dumps global objects
that are common to all databases.
(<application>pg_dump</application> does not save these objects.)
This currently includes
the
information about database users and
groups.
This currently includes information about database users and
groups
, and access permissions that apply to databases as a whole
.
</para>
<para>
...
...
@@ -75,9 +75,20 @@ PostgreSQL documentation
<title>Options</title>
<para>
The following command-line options are used to control the output format.
The following command-line options are used to control the content and
format of the output.
<variablelist>
<varlistentry>
<term><option>-a</></term>
<term><option>--data-only</></term>
<listitem>
<para>
Dump only the data, not the schema (data definitions).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-c</option></term>
<term><option>--clean</option></term>
...
...
@@ -161,6 +172,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option></term>
<term><option>--schema-only</option></term>
<listitem>
<para>
Dump only the schema (data definitions), no data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</></term>
<term><option>--verbose</></term>
...
...
@@ -172,6 +193,17 @@ PostgreSQL documentation
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-x</></term>
<term><option>--no-privileges</></term>
<term><option>--no-acl</></term>
<listitem>
<para>
Prevent dumping of access privileges (grant/revoke commands).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
...
...
This diff is collapsed.
Click to expand it.
src/bin/pg_dump/pg_dumpall.c
+
40
−
11
View file @
9e1e72b6
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.
19
2003/05/30 2
2
:55:1
6
tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.
20
2003/05/30 2
3
:55:1
0
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -60,6 +60,7 @@ static char *findPgDump(const char *argv0);
char
*
pgdumploc
;
PQExpBuffer
pgdumpopts
;
bool
output_clean
=
false
;
bool
skip_acls
=
false
;
bool
verbose
=
false
;
int
server_version
;
...
...
@@ -72,11 +73,14 @@ main(int argc, char *argv[])
char
*
pgport
=
NULL
;
char
*
pguser
=
NULL
;
bool
force_password
=
false
;
bool
data_only
=
false
;
bool
globals_only
=
false
;
bool
schema_only
=
false
;
PGconn
*
conn
;
int
c
;
static
struct
option
long_options
[]
=
{
{
"data-only"
,
no_argument
,
NULL
,
'a'
},
{
"clean"
,
no_argument
,
NULL
,
'c'
},
{
"inserts"
,
no_argument
,
NULL
,
'd'
},
{
"attribute-inserts"
,
no_argument
,
NULL
,
'D'
},
...
...
@@ -87,8 +91,11 @@ main(int argc, char *argv[])
{
"oids"
,
no_argument
,
NULL
,
'o'
},
{
"port"
,
required_argument
,
NULL
,
'p'
},
{
"password"
,
no_argument
,
NULL
,
'W'
},
{
"schema-only"
,
no_argument
,
NULL
,
's'
},
{
"username"
,
required_argument
,
NULL
,
'U'
},
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
{
"no-privileges"
,
no_argument
,
NULL
,
'x'
},
{
"no-acl"
,
no_argument
,
NULL
,
'x'
},
{
NULL
,
0
,
NULL
,
0
}
};
...
...
@@ -119,10 +126,15 @@ main(int argc, char *argv[])
pgdumploc
=
findPgDump
(
argv
[
0
]);
pgdumpopts
=
createPQExpBuffer
();
while
((
c
=
getopt_long
(
argc
,
argv
,
"cdDgh:iop:U:vW"
,
long_options
,
&
optindex
))
!=
-
1
)
while
((
c
=
getopt_long
(
argc
,
argv
,
"
a
cdDgh:iop:
s
U:vW
x
"
,
long_options
,
&
optindex
))
!=
-
1
)
{
switch
(
c
)
{
case
'a'
:
data_only
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -a"
);
break
;
case
'c'
:
output_clean
=
true
;
break
;
...
...
@@ -151,6 +163,11 @@ main(int argc, char *argv[])
appendPQExpBuffer
(
pgdumpopts
,
" -p '%s'"
,
pgport
);
break
;
case
's'
:
schema_only
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -s"
);
break
;
case
'U'
:
pguser
=
optarg
;
appendPQExpBuffer
(
pgdumpopts
,
" -U '%s'"
,
pguser
);
...
...
@@ -166,6 +183,11 @@ main(int argc, char *argv[])
appendPQExpBuffer
(
pgdumpopts
,
" -W"
);
break
;
case
'x'
:
skip_acls
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -x"
);
break
;
default:
fprintf
(
stderr
,
_
(
"Try '%s --help' for more information.
\n
"
),
progname
);
exit
(
1
);
...
...
@@ -189,16 +211,19 @@ main(int argc, char *argv[])
printf
(
"--
\n\n
"
);
printf
(
"
\\
connect
\"
template1
\"\n\n
"
);
dumpUsers
(
conn
);
dumpGroups
(
conn
);
if
(
globals_only
)
goto
end
;
if
(
!
data_only
)
{
dumpUsers
(
conn
);
dumpGroups
(
conn
);
}
dumpCreateDB
(
conn
);
dumpDatabases
(
conn
);
if
(
!
globals_only
)
{
if
(
!
data_only
)
dumpCreateDB
(
conn
);
dumpDatabases
(
conn
);
}
end:
PQfinish
(
conn
);
exit
(
0
);
}
...
...
@@ -213,14 +238,17 @@ help(void)
printf
(
_
(
" %s [OPTION]...
\n
"
),
progname
);
printf
(
_
(
"
\n
Options:
\n
"
));
printf
(
_
(
" -a, --data-only dump only the data, not the schema
\n
"
));
printf
(
_
(
" -c, --clean clean (drop) databases prior to create
\n
"
));
printf
(
_
(
" -d, --inserts dump data as INSERT, rather than COPY, commands
\n
"
));
printf
(
_
(
" -D, --column-inserts dump data as INSERT commands with column names
\n
"
));
printf
(
_
(
" -g, --globals-only dump only global objects, no databases
\n
"
));
printf
(
_
(
" -i, --ignore-version proceed even when server version mismatches
\n
"
" pg_dumpall version
\n
"
));
printf
(
_
(
" -s, --schema-only dump only the schema, no data
\n
"
));
printf
(
_
(
" -o, --oids include OIDs in dump
\n
"
));
printf
(
_
(
" -v, --verbose verbose mode
\n
"
));
printf
(
_
(
" -x, --no-privileges do not dump privileges (grant/revoke)
\n
"
));
printf
(
_
(
" --help show this help, then exit
\n
"
));
printf
(
_
(
" --version output version information, then exit
\n
"
));
...
...
@@ -462,7 +490,8 @@ dumpCreateDB(PGconn *conn)
appendPQExpBuffer
(
buf
,
";
\n
"
);
}
if
(
!
buildACLCommands
(
fdbname
,
"DATABASE"
,
dbacl
,
dbowner
,
if
(
!
skip_acls
&&
!
buildACLCommands
(
fdbname
,
"DATABASE"
,
dbacl
,
dbowner
,
server_version
,
buf
))
{
fprintf
(
stderr
,
_
(
"%s: could not parse ACL list (%s) for database %s
\n
"
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment