From 72fe188b1cf01101f14d9914f48935781d756c8a Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Thu, 30 Sep 2010 10:44:13 -0500 Subject: [PATCH] Fix sql script, specially the view that was lacking of an alias Reported and patch by: Cedric Villemain --- repmgr.sql | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/repmgr.sql b/repmgr.sql index e3bf982b..e7d48741 100644 --- a/repmgr.sql +++ b/repmgr.sql @@ -1,22 +1,20 @@ -drop table if exists repl_nodes; - /* * The table repl_nodes keeps information about all machines in * a cluster */ +drop table if exists repl_nodes cascade; CREATE TABLE repl_nodes ( id integer primary key, cluster text not null, -- Name to identify the cluster conninfo text not null ); -drop table if exists repl_status; - /* - * Keeps monitor info about every node and their "position" relative + * Keeps monitor info about every node and their relative "position" * to primary */ -CREATE TABLE repl_monitor( +drop table if exists repl_monitor cascade; +CREATE TABLE repl_monitor ( primary_node INTEGER NOT NULL, standby_node INTEGER NOT NULL, last_monitor_time TIMESTAMP WITH TIME ZONE NOT NULL, @@ -30,8 +28,9 @@ CREATE TABLE repl_monitor( /* * A useful view */ +drop view if exists repl_status; CREATE VIEW repl_status AS SELECT *, now() - (select max(last_monitor_time) from repl_monitor b where b.primary_node = a.primary_node and b.standby_node = a.standby_node) - FROM repl_monitor; + FROM repl_monitor a;