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
This commit is contained in:
Martin
2016-06-02 13:56:06 -03:00
parent f18d629bd2
commit 0dd617cfca

View File

@@ -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;