From 0dd617cfca8483fcd124f6f993587c1f59cc3383 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 2 Jun 2016 13:56:06 -0300 Subject: [PATCH] The ALTER TABLE to set the foreign key as DEFERRABLE only worked on 9.4+, as there is no ALTER CONSTRAINT in 9.3. This new ALTER TABLE does the same in two hops by removing the foreign key and creating it again in the same ALTER TABLE. This fixes #183 --- sql/repmgr3.1.1_repmgr3.1.2.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/repmgr3.1.1_repmgr3.1.2.sql b/sql/repmgr3.1.1_repmgr3.1.2.sql index 7dedacc8..36b3dc79 100644 --- a/sql/repmgr3.1.1_repmgr3.1.2.sql +++ b/sql/repmgr3.1.1_repmgr3.1.2.sql @@ -27,5 +27,6 @@ BEGIN; -ALTER TABLE repl_nodes ALTER CONSTRAINT repl_nodes_upstream_node_id_fkey DEFERRABLE; +ALTER TABLE repl_nodes DROP CONSTRAINT repl_nodes_upstream_node_id_fkey, + ADD CONSTRAINT repl_nodes_upstream_node_id_fkey FOREIGN KEY (upstream_node_id) REFERENCES repl_nodes(id) DEFERRABLE; COMMIT;