From a0b6306f7f55440902fca02deeda2b04a36ff021 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Fri, 3 Jul 2015 19:30:27 +0800 Subject: [PATCH] Revert "Don't check for presence of a PRIMARY KEY if not replicating rows" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This reverts commit 15abe5e5946c1542ecf43b42c69ba03c984d199f as the initial change was too naïve. The check shouldn't be within the loop. It should run after the DDL lock check, since it could change data in the table in ways that means the incoming DDL might not apply anymore, e.g. inserting a NULL value into an otherwise NULL-free table at the same time an ALTER TABLE ... ALTER COLUMN ... SET NOT NULL comes in. It's also necessary for it to be skipped if the node is read-only so a check like && !node_read_only is needed. --- bdr_executor.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bdr_executor.c b/bdr_executor.c index c5e196b5b9..963ff74226 100644 --- a/bdr_executor.c +++ b/bdr_executor.c @@ -950,13 +950,6 @@ BdrExecutorStart(QueryDesc *queryDesc, int eflags) continue; } - /* If replication is suppressed then no key is required */ - if (bdr_do_not_replicate) - { - RelationClose(rel); - continue; - } - /* * Since changes to pg_catalog aren't replicated directly there's * no strong need to suppress direct UPDATEs on them. The usual -- 2.39.5