Re: [SQL] Trigger definition . . . puzzled

2007-12-12 Thread Rolf A. de By
Erik, Thanks for that. There is some misunderstanding here. For this example, I had taken the sting out of my trigger function and turned it into a much more concise no-op, with warnings. The actual code of my original trigger function is irrelevant. The no-op trigger function displays the

Re: [SQL] Trigger definition . . . puzzled

2007-12-12 Thread Erik Jones
On Dec 12, 2007, at 3:38 PM, Rolf A. de By wrote: Greetings list, Running pg 8.2.3. on a windows machine, I have become blind in a trigger definition puzzle, so hope that somebody may help me understand where I goof. I have a base table i_s that has three tables that inherit from it,

[SQL] Trigger definition . . . puzzled

2007-12-12 Thread Rolf A. de By
Greetings list, Running pg 8.2.3. on a windows machine, I have become blind in a trigger definition puzzle, so hope that somebody may help me understand where I goof. I have a base table i_s that has three tables that inherit from it, one of them being i_s_nowhere. The base table should be

Re: [SQL] Query Assistance

2007-12-12 Thread Richard Huxton
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

Re: [SQL] Query design assistance - getting daily totals

2007-12-12 Thread Rodrigo De León
On Dec 12, 2007 1:39 AM, Paul Lambert <[EMAIL PROTECTED]> wrote: > It's a financial application which needs to work using a concept of > 'financial periods' which may not necessarily correspond to calendar > months and it's much easier to manage in this way than it is to merge it > all together usi

Re: [SQL] Query Assistance

2007-12-12 Thread Gary Chambers
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 t

Re: [SQL] Query Assistance

2007-12-12 Thread D'Arcy J.M. Cain
On Wed, 12 Dec 2007 11:58:20 -0500 "Gary Chambers" <[EMAIL PROTECTED]> wrote: > 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 (AC power), 2 = Offline (Ba

[SQL] Query Assistance

2007-12-12 Thread Gary Chambers
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 (AC power), 2 = Offline (Battery) sid smallint NOT NULL, -- Timestamp of transition statetime timestamp witho

Re: [SQL] Query design assistance - getting daily totals

2007-12-12 Thread Scott Marlowe
On Dec 12, 2007 12:39 AM, Paul Lambert <[EMAIL PROTECTED]> wrote: > A. Kretschmer wrote: > > am Wed, dem 12.12.2007, um 10:34:35 +0900 mailte Paul Lambert folgendes: > >> year_id integer > >> month_id integer > >> working_day integer > > > > Why this broken data types? We have date and timestamp[t

Re: [SQL] join on three tables is slow

2007-12-12 Thread Gerry Reno
Tom Lane wrote: Gerry Reno <[EMAIL PROTECTED]> writes: Pavel Stehule wrote: there is diference in agg position. Send, please, query and explain analyze output. [ explain analyze output ] The rowcount estimates seem pretty far off, even for simple cases that I'd expect it to ge