mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
Fix sql script, specially the view that was lacking of an alias
Reported and patch by: Cedric Villemain
This commit is contained in:
13
repmgr.sql
13
repmgr.sql
@@ -1,22 +1,20 @@
|
|||||||
drop table if exists repl_nodes;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The table repl_nodes keeps information about all machines in
|
* The table repl_nodes keeps information about all machines in
|
||||||
* a cluster
|
* a cluster
|
||||||
*/
|
*/
|
||||||
|
drop table if exists repl_nodes cascade;
|
||||||
CREATE TABLE repl_nodes (
|
CREATE TABLE repl_nodes (
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
cluster text not null, -- Name to identify the cluster
|
cluster text not null, -- Name to identify the cluster
|
||||||
conninfo text not null
|
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
|
* to primary
|
||||||
*/
|
*/
|
||||||
CREATE TABLE repl_monitor(
|
drop table if exists repl_monitor cascade;
|
||||||
|
CREATE TABLE repl_monitor (
|
||||||
primary_node INTEGER NOT NULL,
|
primary_node INTEGER NOT NULL,
|
||||||
standby_node INTEGER NOT NULL,
|
standby_node INTEGER NOT NULL,
|
||||||
last_monitor_time TIMESTAMP WITH TIME ZONE NOT NULL,
|
last_monitor_time TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||||
@@ -30,8 +28,9 @@ CREATE TABLE repl_monitor(
|
|||||||
/*
|
/*
|
||||||
* A useful view
|
* A useful view
|
||||||
*/
|
*/
|
||||||
|
drop view if exists repl_status;
|
||||||
CREATE VIEW repl_status AS
|
CREATE VIEW repl_status AS
|
||||||
SELECT *, now() - (select max(last_monitor_time) from repl_monitor b
|
SELECT *, now() - (select max(last_monitor_time) from repl_monitor b
|
||||||
where b.primary_node = a.primary_node
|
where b.primary_node = a.primary_node
|
||||||
and b.standby_node = a.standby_node)
|
and b.standby_node = a.standby_node)
|
||||||
FROM repl_monitor;
|
FROM repl_monitor a;
|
||||||
|
|||||||
Reference in New Issue
Block a user