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
be926474
Commit
be926474
authored
Jan 25, 2013
by
Magnus Hagander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pg_dump exclude unlogged table data on hot standby slaves
Noted by Joe Van Dyk
parent
760f3c04
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
doc/src/sgml/ref/pg_dump.sgml
doc/src/sgml/ref/pg_dump.sgml
+2
-1
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+18
-0
No files found.
doc/src/sgml/ref/pg_dump.sgml
View file @
be926474
...
@@ -713,7 +713,8 @@ PostgreSQL documentation
...
@@ -713,7 +713,8 @@ PostgreSQL documentation
<para>
<para>
Do not dump the contents of unlogged tables. This option has no
Do not dump the contents of unlogged tables. This option has no
effect on whether or not the table definitions (schema) are dumped;
effect on whether or not the table definitions (schema) are dumped;
it only suppresses dumping the table data.
it only suppresses dumping the table data. Data in unlogged tables
is always excluded when dumping from a standby server.
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
src/bin/pg_dump/pg_dump.c
View file @
be926474
...
@@ -605,6 +605,24 @@ main(int argc, char **argv)
...
@@ -605,6 +605,24 @@ main(int argc, char **argv)
if
(
fout
->
remoteVersion
<
90100
)
if
(
fout
->
remoteVersion
<
90100
)
no_security_labels
=
1
;
no_security_labels
=
1
;
/*
* When running against 9.0 or later, check if we are in recovery mode,
* which means we are on a hot standby.
*/
if
(
fout
->
remoteVersion
>=
90000
)
{
PGresult
*
res
=
ExecuteSqlQueryForSingleRow
(
fout
,
"SELECT pg_catalog.pg_is_in_recovery()"
);
if
(
strcmp
(
PQgetvalue
(
res
,
0
,
0
),
"t"
)
==
0
)
{
/*
* On hot standby slaves, never try to dump unlogged table data,
* since it will just throw an error.
*/
no_unlogged_table_data
=
true
;
}
PQclear
(
res
);
}
/*
/*
* Start transaction-snapshot mode transaction to dump consistent data.
* Start transaction-snapshot mode transaction to dump consistent data.
*/
*/
...
...
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