Re: [SQL] Rule causes baffling error

2005-12-20 Thread Richard Huxton
Ken Winter wrote: Richard ~ Let me zoom out for a moment, for the bigger picture. As you have inferred, what I'm trying to do is develop a history-preserving table ("my_data" in the example that started this thread). *Most* user programs would see and manipulate this table as if it contained o

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Ken Winter
nks for your help. I hope this little essay is of some value to others. ~ Ken > -Original Message- > From: Richard Huxton [mailto:[EMAIL PROTECTED] > Sent: Monday, December 19, 2005 11:05 AM > To: Ken Winter > Cc: 'PostgreSQL pg-sql list' > Subject: Re: [SQL]

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Tom Lane
Richard Huxton writes: > Ken Winter wrote: >> Can a trigger be written on a *view*? > There's nothing for them to fire against even if you could attach the > trigger. Currently we reject CREATE TRIGGER on a view, but it occurred to me the other day that that could be relaxed, at least for BEFOR

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Richard Huxton
Ken Winter wrote: Richard ~ Thanks for your response. Can a trigger be written on a *view*? I can't find anything in the PostgreSQL docs that answers this question. There's nothing for them to fire against even if you could attach the trigger. I suppose you could have a statement-level trig

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Ken Winter
ns was as rules. ~ Ken > -Original Message- > From: Richard Huxton [mailto:[EMAIL PROTECTED] > Sent: Monday, December 19, 2005 4:08 AM > To: Ken Winter > Cc: 'PostgreSQL pg-sql list' > Subject: Re: [SQL] Rule causes baffling error > > Ken Winter wrote: > >

Re: [SQL] Rule causes baffling error

2005-12-19 Thread Richard Huxton
Ken Winter wrote: This rule is supposed to (1) cause an update directed to the view "my_data_now" to be made to the underlying table "my_data", (2) reset the "effective_date_and_time" of that row to 'now', (3) insert a record containing the old values into "my_data", and (4) expire that "old" rec

[SQL] Rule causes baffling error

2005-12-16 Thread Ken Winter
I'm trying to figure out why a rule gives me a uniqueness violation when I try to do an update. I have a table, "my_data", defined as: create table my_data ( id INT8 not null default nextval('person_seq'), effective_date_and_time TIMESTAMP WITH TIME ZONE not null default CURRENT_T