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 @@ -713,7 +713,8 @@ PostgreSQL documentation
713713 <para>
714714 Do not dump the contents of unlogged tables. This option has no
715715 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.
717718 </para>
718719 </listitem>
719720 </varlistentry>
Original file line number Diff line number Diff line change @@ -605,6 +605,24 @@ main(int argc, char **argv)
605605 if (fout -> remoteVersion < 90100 )
606606 no_security_labels = 1 ;
607607
608+ /*
609+ * When running against 9.0 or later, check if we are in recovery mode,
610+ * which means we are on a hot standby.
611+ */
612+ if (fout -> remoteVersion >= 90000 )
613+ {
614+ PGresult * res = ExecuteSqlQueryForSingleRow (fout , "SELECT pg_catalog.pg_is_in_recovery()" );
615+ if (strcmp (PQgetvalue (res , 0 , 0 ), "t" ) == 0 )
616+ {
617+ /*
618+ * On hot standby slaves, never try to dump unlogged table data,
619+ * since it will just throw an error.
620+ */
621+ no_unlogged_table_data = true;
622+ }
623+ PQclear (res );
624+ }
625+
608626 /*
609627 * Start transaction-snapshot mode transaction to dump consistent data.
610628 */
You can’t perform that action at this time.
0 commit comments