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
d68714b2
Commit
d68714b2
authored
14 years ago
by
Peter Eisentraut
Browse files
Options
Downloads
Patches
Plain Diff
Allow pg_basebackup compressed tar output to stdout
parent
1b6dabc4
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_basebackup.sgml
+1
-2
1 addition, 2 deletions
doc/src/sgml/ref/pg_basebackup.sgml
src/bin/pg_basebackup/pg_basebackup.c
+24
-10
24 additions, 10 deletions
src/bin/pg_basebackup/pg_basebackup.c
with
25 additions
and
12 deletions
doc/src/sgml/ref/pg_basebackup.sgml
+
1
−
2
View file @
d68714b2
...
@@ -174,8 +174,7 @@ PostgreSQL documentation
...
@@ -174,8 +174,7 @@ PostgreSQL documentation
<listitem>
<listitem>
<para>
<para>
Enables gzip compression of tar file output. Compression is only
Enables gzip compression of tar file output. Compression is only
available when generating tar files, and is not available when sending
available when using the tar format.
output to standard output.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
This diff is collapsed.
Click to expand it.
src/bin/pg_basebackup/pg_basebackup.c
+
24
−
10
View file @
d68714b2
...
@@ -261,7 +261,22 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
...
@@ -261,7 +261,22 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
* Base tablespaces
* Base tablespaces
*/
*/
if
(
strcmp
(
basedir
,
"-"
)
==
0
)
if
(
strcmp
(
basedir
,
"-"
)
==
0
)
tarfile
=
stdout
;
{
#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
else
{
{
#ifdef HAVE_LIBZ
#ifdef HAVE_LIBZ
...
@@ -384,7 +399,14 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
...
@@ -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
#ifdef HAVE_LIBZ
if
(
ztarfile
!=
NULL
)
if
(
ztarfile
!=
NULL
)
...
@@ -1076,14 +1098,6 @@ main(int argc, char **argv)
...
@@ -1076,14 +1098,6 @@ main(int argc, char **argv)
progname
);
progname
);
exit
(
1
);
exit
(
1
);
}
}
#else
if
(
compresslevel
>
0
&&
strcmp
(
basedir
,
"-"
)
==
0
)
{
fprintf
(
stderr
,
_
(
"%s: compression is not supported on standard output
\n
"
),
progname
);
exit
(
1
);
}
#endif
#endif
/*
/*
...
...
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