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
d68714b2
Commit
d68714b2
authored
May 29, 2011
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow pg_basebackup compressed tar output to stdout
parent
1b6dabc4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
doc/src/sgml/ref/pg_basebackup.sgml
doc/src/sgml/ref/pg_basebackup.sgml
+1
-2
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_basebackup.c
+24
-10
No files found.
doc/src/sgml/ref/pg_basebackup.sgml
View file @
d68714b2
...
...
@@ -174,8 +174,7 @@ PostgreSQL documentation
<listitem>
<para>
Enables gzip compression of tar file output. Compression is only
available when generating tar files, and is not available when sending
output to standard output.
available when using the tar format.
</para>
</listitem>
</varlistentry>
...
...
src/bin/pg_basebackup/pg_basebackup.c
View file @
d68714b2
...
...
@@ -261,7 +261,22 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
* Base tablespaces
*/
if
(
strcmp
(
basedir
,
"-"
)
==
0
)
{
#ifdef HAVE_LIBZ
if
(
compresslevel
>
0
)
{
ztarfile
=
gzdopen
(
dup
(
fileno
(
stdout
)),
"wb"
);
if
(
gzsetparams
(
ztarfile
,
compresslevel
,
Z_DEFAULT_STRATEGY
)
!=
Z_OK
)
{
fprintf
(
stderr
,
_
(
"%s: could not set compression level %i: %s
\n
"
),
progname
,
compresslevel
,
get_gz_error
(
ztarfile
));
disconnect_and_exit
(
1
);
}
}
else
#endif
tarfile
=
stdout
;
}
else
{
#ifdef HAVE_LIBZ
...
...
@@ -384,7 +399,14 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
}
}
if
(
strcmp
(
basedir
,
"-"
)
!=
0
)
if
(
strcmp
(
basedir
,
"-"
)
==
0
)
{
#ifdef HAVE_LIBZ
if
(
ztarfile
)
gzclose
(
ztarfile
);
#endif
}
else
{
#ifdef HAVE_LIBZ
if
(
ztarfile
!=
NULL
)
...
...
@@ -1076,14 +1098,6 @@ main(int argc, char **argv)
progname
);
exit
(
1
);
}
#else
if
(
compresslevel
>
0
&&
strcmp
(
basedir
,
"-"
)
==
0
)
{
fprintf
(
stderr
,
_
(
"%s: compression is not supported on standard output
\n
"
),
progname
);
exit
(
1
);
}
#endif
/*
...
...
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