Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9e1e72b6
Commit
9e1e72b6
authored
May 30, 2003
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cause pg_dumpall to support the -a, -s, -x options of pg_dump.
parent
df1df6bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
15 deletions
+76
-15
doc/src/sgml/ref/pg_dumpall.sgml
doc/src/sgml/ref/pg_dumpall.sgml
+36
-4
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+40
-11
No files found.
doc/src/sgml/ref/pg_dumpall.sgml
View file @
9e1e72b6
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.3
8 2003/03/24 14:32:51 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.3
9 2003/05/30 23:55:10 tgl
Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -35,8 +35,8 @@ PostgreSQL documentation
...
@@ -35,8 +35,8 @@ PostgreSQL documentation
<application>pg_dumpall</application> also dumps global objects
<application>pg_dumpall</application> also dumps global objects
that are common to all databases.
that are common to all databases.
(<application>pg_dump</application> does not save these objects.)
(<application>pg_dump</application> does not save these objects.)
This currently includes
the
information about database users and
This currently includes information about database users and
groups.
groups
, and access permissions that apply to databases as a whole
.
</para>
</para>
<para>
<para>
...
@@ -75,9 +75,20 @@ PostgreSQL documentation
...
@@ -75,9 +75,20 @@ PostgreSQL documentation
<title>Options</title>
<title>Options</title>
<para>
<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>
<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>
<varlistentry>
<term><option>-c</option></term>
<term><option>-c</option></term>
<term><option>--clean</option></term>
<term><option>--clean</option></term>
...
@@ -161,6 +172,16 @@ PostgreSQL documentation
...
@@ -161,6 +172,16 @@ PostgreSQL documentation
</listitem>
</listitem>
</varlistentry>
</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>
<varlistentry>
<term><option>-v</></term>
<term><option>-v</></term>
<term><option>--verbose</></term>
<term><option>--verbose</></term>
...
@@ -172,6 +193,17 @@ PostgreSQL documentation
...
@@ -172,6 +193,17 @@ PostgreSQL documentation
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</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>
</variablelist>
</para>
</para>
...
...
src/bin/pg_dump/pg_dumpall.c
View file @
9e1e72b6
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* 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 22:55:16
tgl Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.
20 2003/05/30 23:55:10
tgl Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -60,6 +60,7 @@ static char *findPgDump(const char *argv0);
...
@@ -60,6 +60,7 @@ static char *findPgDump(const char *argv0);
char
*
pgdumploc
;
char
*
pgdumploc
;
PQExpBuffer
pgdumpopts
;
PQExpBuffer
pgdumpopts
;
bool
output_clean
=
false
;
bool
output_clean
=
false
;
bool
skip_acls
=
false
;
bool
verbose
=
false
;
bool
verbose
=
false
;
int
server_version
;
int
server_version
;
...
@@ -72,11 +73,14 @@ main(int argc, char *argv[])
...
@@ -72,11 +73,14 @@ main(int argc, char *argv[])
char
*
pgport
=
NULL
;
char
*
pgport
=
NULL
;
char
*
pguser
=
NULL
;
char
*
pguser
=
NULL
;
bool
force_password
=
false
;
bool
force_password
=
false
;
bool
data_only
=
false
;
bool
globals_only
=
false
;
bool
globals_only
=
false
;
bool
schema_only
=
false
;
PGconn
*
conn
;
PGconn
*
conn
;
int
c
;
int
c
;
static
struct
option
long_options
[]
=
{
static
struct
option
long_options
[]
=
{
{
"data-only"
,
no_argument
,
NULL
,
'a'
},
{
"clean"
,
no_argument
,
NULL
,
'c'
},
{
"clean"
,
no_argument
,
NULL
,
'c'
},
{
"inserts"
,
no_argument
,
NULL
,
'd'
},
{
"inserts"
,
no_argument
,
NULL
,
'd'
},
{
"attribute-inserts"
,
no_argument
,
NULL
,
'D'
},
{
"attribute-inserts"
,
no_argument
,
NULL
,
'D'
},
...
@@ -87,8 +91,11 @@ main(int argc, char *argv[])
...
@@ -87,8 +91,11 @@ main(int argc, char *argv[])
{
"oids"
,
no_argument
,
NULL
,
'o'
},
{
"oids"
,
no_argument
,
NULL
,
'o'
},
{
"port"
,
required_argument
,
NULL
,
'p'
},
{
"port"
,
required_argument
,
NULL
,
'p'
},
{
"password"
,
no_argument
,
NULL
,
'W'
},
{
"password"
,
no_argument
,
NULL
,
'W'
},
{
"schema-only"
,
no_argument
,
NULL
,
's'
},
{
"username"
,
required_argument
,
NULL
,
'U'
},
{
"username"
,
required_argument
,
NULL
,
'U'
},
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
{
"verbose"
,
no_argument
,
NULL
,
'v'
},
{
"no-privileges"
,
no_argument
,
NULL
,
'x'
},
{
"no-acl"
,
no_argument
,
NULL
,
'x'
},
{
NULL
,
0
,
NULL
,
0
}
{
NULL
,
0
,
NULL
,
0
}
};
};
...
@@ -119,10 +126,15 @@ main(int argc, char *argv[])
...
@@ -119,10 +126,15 @@ main(int argc, char *argv[])
pgdumploc
=
findPgDump
(
argv
[
0
]);
pgdumploc
=
findPgDump
(
argv
[
0
]);
pgdumpopts
=
createPQExpBuffer
();
pgdumpopts
=
createPQExpBuffer
();
while
((
c
=
getopt_long
(
argc
,
argv
,
"
cdDgh:iop:U:vW
"
,
long_options
,
&
optindex
))
!=
-
1
)
while
((
c
=
getopt_long
(
argc
,
argv
,
"
acdDgh:iop:sU:vWx
"
,
long_options
,
&
optindex
))
!=
-
1
)
{
{
switch
(
c
)
switch
(
c
)
{
{
case
'a'
:
data_only
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -a"
);
break
;
case
'c'
:
case
'c'
:
output_clean
=
true
;
output_clean
=
true
;
break
;
break
;
...
@@ -151,6 +163,11 @@ main(int argc, char *argv[])
...
@@ -151,6 +163,11 @@ main(int argc, char *argv[])
appendPQExpBuffer
(
pgdumpopts
,
" -p '%s'"
,
pgport
);
appendPQExpBuffer
(
pgdumpopts
,
" -p '%s'"
,
pgport
);
break
;
break
;
case
's'
:
schema_only
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -s"
);
break
;
case
'U'
:
case
'U'
:
pguser
=
optarg
;
pguser
=
optarg
;
appendPQExpBuffer
(
pgdumpopts
,
" -U '%s'"
,
pguser
);
appendPQExpBuffer
(
pgdumpopts
,
" -U '%s'"
,
pguser
);
...
@@ -166,6 +183,11 @@ main(int argc, char *argv[])
...
@@ -166,6 +183,11 @@ main(int argc, char *argv[])
appendPQExpBuffer
(
pgdumpopts
,
" -W"
);
appendPQExpBuffer
(
pgdumpopts
,
" -W"
);
break
;
break
;
case
'x'
:
skip_acls
=
true
;
appendPQExpBuffer
(
pgdumpopts
,
" -x"
);
break
;
default:
default:
fprintf
(
stderr
,
_
(
"Try '%s --help' for more information.
\n
"
),
progname
);
fprintf
(
stderr
,
_
(
"Try '%s --help' for more information.
\n
"
),
progname
);
exit
(
1
);
exit
(
1
);
...
@@ -189,16 +211,19 @@ main(int argc, char *argv[])
...
@@ -189,16 +211,19 @@ main(int argc, char *argv[])
printf
(
"--
\n\n
"
);
printf
(
"--
\n\n
"
);
printf
(
"
\\
connect
\"
template1
\"\n\n
"
);
printf
(
"
\\
connect
\"
template1
\"\n\n
"
);
dumpUsers
(
conn
);
if
(
!
data_only
)
dumpGroups
(
conn
);
{
dumpUsers
(
conn
);
if
(
globals_only
)
dumpGroups
(
conn
);
goto
end
;
}
dumpCreateDB
(
conn
);
if
(
!
globals_only
)
dumpDatabases
(
conn
);
{
if
(
!
data_only
)
dumpCreateDB
(
conn
);
dumpDatabases
(
conn
);
}
end:
PQfinish
(
conn
);
PQfinish
(
conn
);
exit
(
0
);
exit
(
0
);
}
}
...
@@ -213,14 +238,17 @@ help(void)
...
@@ -213,14 +238,17 @@ help(void)
printf
(
_
(
" %s [OPTION]...
\n
"
),
progname
);
printf
(
_
(
" %s [OPTION]...
\n
"
),
progname
);
printf
(
_
(
"
\n
Options:
\n
"
));
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
(
_
(
" -c, --clean clean (drop) databases prior to create
\n
"
));
printf
(
_
(
" -d, --inserts dump data as INSERT, rather than COPY, commands
\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
(
_
(
" -D, --column-inserts dump data as INSERT commands with column names
\n
"
));
printf
(
_
(
" -g, --globals-only dump only global objects, no databases
\n
"
));
printf
(
_
(
" -g, --globals-only dump only global objects, no databases
\n
"
));
printf
(
_
(
" -i, --ignore-version proceed even when server version mismatches
\n
"
printf
(
_
(
" -i, --ignore-version proceed even when server version mismatches
\n
"
" pg_dumpall version
\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
(
_
(
" -o, --oids include OIDs in dump
\n
"
));
printf
(
_
(
" -v, --verbose verbose mode
\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
(
_
(
" --help show this help, then exit
\n
"
));
printf
(
_
(
" --version output version information, then exit
\n
"
));
printf
(
_
(
" --version output version information, then exit
\n
"
));
...
@@ -462,7 +490,8 @@ dumpCreateDB(PGconn *conn)
...
@@ -462,7 +490,8 @@ dumpCreateDB(PGconn *conn)
appendPQExpBuffer
(
buf
,
";
\n
"
);
appendPQExpBuffer
(
buf
,
";
\n
"
);
}
}
if
(
!
buildACLCommands
(
fdbname
,
"DATABASE"
,
dbacl
,
dbowner
,
if
(
!
skip_acls
&&
!
buildACLCommands
(
fdbname
,
"DATABASE"
,
dbacl
,
dbowner
,
server_version
,
buf
))
server_version
,
buf
))
{
{
fprintf
(
stderr
,
_
(
"%s: could not parse ACL list (%s) for database %s
\n
"
),
fprintf
(
stderr
,
_
(
"%s: could not parse ACL list (%s) for database %s
\n
"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment