All...
I have a simple table in PostgreSQL 8.2.5:
CREATE TABLE power_transitions ( -- Transition ID (PK) tid integer NOT NULL, -- State ID (0 = Unknown, 1 = Online
(ACpower), 2 = Offline (Battery) sid smallint NOT NULL, -- Timestamp of transition statetime timestamp without
timezone DEFAULT now() NOT NULL, -- Is this a real outage? is_outage boolean DEFAULT true NOT NULL
);
It contains a log of power outages (transitions). I'd like to create
query that returns a transition offline time and associated return to
online time. Is there a better way of handling this? I am open to
schema change suggestions. Thanks very much!
-- Gary Chambers
// Nothing fancy and nothing Microsoft!