From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Gary Chambers <gwchamb(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Query Assistance |
Date: | 2007-12-12 20:21:21 |
Message-ID: | 476042C1.8070707@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Gary Chambers wrote:
> D'Arcy...
>
>> Have you considered this?
>
> I considered integrating the begin and end times into the table. I'm
> capturing the data via ACPI events, so it's "transactional" by nature.
> I want to be able to keep track of false transitions (hence the
> is_outage field).
>
> I'm looking for a way to simplify the transitions output on my web
> browser, and I want to combine an offline and a corresponding online
> time into a single line.
How about a "paired_with" field that references the power_transitions
table and a trigger. When you insert a new row, it checks what the
previous row was - if it's a down & this is an up, then set the
paired_with field on each.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Rolf A. de By | 2007-12-12 21:38:16 | Trigger definition . . . puzzled |
Previous Message | Rodrigo De León | 2007-12-12 19:53:08 | Re: Query design assistance - getting daily totals |