File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -678,7 +678,8 @@ PostgreSQL documentation
678
678
<para>
679
679
Do not dump the contents of unlogged tables. This option has no
680
680
effect on whether or not the table definitions (schema) are dumped;
681
- it only suppresses dumping the table data.
681
+ it only suppresses dumping the table data. Data in unlogged tables
682
+ is always excluded when dumping from a standby server.
682
683
</para>
683
684
</listitem>
684
685
</varlistentry>
Original file line number Diff line number Diff line change @@ -652,6 +652,24 @@ main(int argc, char **argv)
652
652
if (g_fout -> remoteVersion < 90100 )
653
653
no_security_labels = 1 ;
654
654
655
+ /*
656
+ * When running against 9.0 or later, check if we are in recovery mode,
657
+ * which means we are on a hot standby.
658
+ */
659
+ if (fout -> remoteVersion >= 90000 )
660
+ {
661
+ PGresult * res = ExecuteSqlQueryForSingleRow (fout , "SELECT pg_catalog.pg_is_in_recovery()" );
662
+ if (strcmp (PQgetvalue (res , 0 , 0 ), "t" ) == 0 )
663
+ {
664
+ /*
665
+ * On hot standby slaves, never try to dump unlogged table data,
666
+ * since it will just throw an error.
667
+ */
668
+ no_unlogged_table_data = true;
669
+ }
670
+ PQclear (res );
671
+ }
672
+
655
673
/*
656
674
* Start transaction-snapshot mode transaction to dump consistent data.
657
675
*/
You can’t perform that action at this time.
0 commit comments