File tree 2 files changed +20
-1
lines changed 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -713,7 +713,8 @@ PostgreSQL documentation
713
713
<para>
714
714
Do not dump the contents of unlogged tables. This option has no
715
715
effect on whether or not the table definitions (schema) are dumped;
716
- it only suppresses dumping the table data.
716
+ it only suppresses dumping the table data. Data in unlogged tables
717
+ is always excluded when dumping from a standby server.
717
718
</para>
718
719
</listitem>
719
720
</varlistentry>
Original file line number Diff line number Diff line change @@ -603,6 +603,24 @@ main(int argc, char **argv)
603
603
if (fout -> remoteVersion < 90100 )
604
604
no_security_labels = 1 ;
605
605
606
+ /*
607
+ * When running against 9.0 or later, check if we are in recovery mode,
608
+ * which means we are on a hot standby.
609
+ */
610
+ if (fout -> remoteVersion >= 90000 )
611
+ {
612
+ PGresult * res = ExecuteSqlQueryForSingleRow (fout , "SELECT pg_catalog.pg_is_in_recovery()" );
613
+ if (strcmp (PQgetvalue (res , 0 , 0 ), "t" ) == 0 )
614
+ {
615
+ /*
616
+ * On hot standby slaves, never try to dump unlogged table data,
617
+ * since it will just throw an error.
618
+ */
619
+ no_unlogged_table_data = true;
620
+ }
621
+ PQclear (res );
622
+ }
623
+
606
624
/*
607
625
* Start transaction-snapshot mode transaction to dump consistent data.
608
626
*/
You can’t perform that action at this time.
0 commit comments