aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication')
-rw-r--r--src/backend/replication/logical/logical.c4
-rw-r--r--src/backend/replication/logical/reorderbuffer.c7
-rw-r--r--src/backend/replication/pgoutput/pgoutput.c26
3 files changed, 11 insertions, 26 deletions
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index 7637efc32e0..e2e39f45779 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -317,6 +317,8 @@ CreateInitDecodingContext(char *plugin,
startup_cb_wrapper(ctx, &ctx->options, true);
MemoryContextSwitchTo(old_context);
+ ctx->reorder->output_rewrites = ctx->options.receive_rewrites;
+
return ctx;
}
@@ -410,6 +412,8 @@ CreateDecodingContext(XLogRecPtr start_lsn,
startup_cb_wrapper(ctx, &ctx->options, false);
MemoryContextSwitchTo(old_context);
+ ctx->reorder->output_rewrites = ctx->options.receive_rewrites;
+
ereport(LOG,
(errmsg("starting logical decoding for slot \"%s\"",
NameStr(slot->data.name)),
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 7612cf5f04c..5ffe638b19c 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -1403,6 +1403,13 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,
goto change_done;
/*
+ * Ignore temporary heaps created during DDL unless the
+ * plugin has asked for them.
+ */
+ if (relation->rd_rel->relrewrite && !rb->output_rewrites)
+ goto change_done;
+
+ /*
* For now ignore sequence changes entirely. Most of the
* time they don't log changes using records we
* understand, so it doesn't make sense to handle the few
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c
index d538f25ede6..aa9cf5b54ed 100644
--- a/src/backend/replication/pgoutput/pgoutput.c
+++ b/src/backend/replication/pgoutput/pgoutput.c
@@ -21,7 +21,6 @@
#include "utils/inval.h"
#include "utils/int8.h"
-#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/syscache.h"
#include "utils/varlena.h"
@@ -511,31 +510,6 @@ get_rel_sync_entry(PGOutputData *data, Oid relid)
{
Publication *pub = lfirst(lc);
- /*
- * Skip tables that look like they are from a heap rewrite (see
- * make_new_heap()). We need to skip them because the subscriber
- * won't have a table by that name to receive the data. That
- * means we won't ship the new data in, say, an added column with
- * a DEFAULT, but if the user applies the same DDL manually on the
- * subscriber, then this will work out for them.
- *
- * We only need to consider the alltables case, because such a
- * transient heap won't be an explicit member of a publication.
- */
- if (pub->alltables)
- {
- char *relname = get_rel_name(relid);
- unsigned int u;
- int n;
-
- if (sscanf(relname, "pg_temp_%u%n", &u, &n) == 1 &&
- relname[n] == '\0')
- {
- if (get_rel_relkind(u) == RELKIND_RELATION)
- break;
- }
- }
-
if (pub->alltables || list_member_oid(pubids, pub->oid))
{
entry->pubactions.pubinsert |= pub->pubactions.pubinsert;