pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Gary Chambers <gwchamb@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Query Assistance
Date: Wed, 12 Dec 2007 20:21:21 +0000
Message-ID: <476042C1.8070707@archonet.com> (raw)
In-Reply-To: <302670f20712121000w6d3c1ecg39620cfa8c39c606@mail.gmail.com>
References: <302670f20712120858k210dd812l8b232ce98d5d162f@mail.gmail.com>
	<20071212123129.ad22c7ce.darcy@druid.net>
	<302670f20712121000w6d3c1ecg39620cfa8c39c606@mail.gmail.com>

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



view thread (7+ messages)

Message-ID: <476042C1.8070707@archonet.com>
Permalink:  ../476042C1.8070707@archonet.com/
Also on:    postgresql.org/message-id/476042C1.8070707@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, gwchamb@gmail.com
  Subject: Re: Query Assistance
  In-Reply-To: <476042C1.8070707@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox