From: | Enrico Weigelt <weigelt(at)metux(dot)de> |
---|---|
To: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | RULE for mtime recording |
Date: | 2005-04-22 01:58:52 |
Message-ID: | 20050422015852.GA1298@nibiru.borg.metux.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi folks,
I'd like to write an update rule, which touches the a mtime field
(=current_timestamp) on normal update - when the mtime field isnt
explicitly set. If the update query explictly sets an mtime value,
this value has to be let through.
my tables look like:
-- base class
CREATE TABLE inode
(
inode_id oid not null default nextval('inode_id_seq'),
mtime timestamp not null default current_timestamp
);
-- example class
CREATE TABLE foo
(
bar text
) INHERITS ( inode );
now if I do
UPDATE foo SET bar = 'xyz' WHERE ...
the mtime should be set to the current time, but on
UPDATE foo SET bar = '123', mtime = '2001-09-11' WHERE ...
we shall have 9/11 as mtime.
Is this possible with rules ?
thx
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service
phone: +49 36207 519931 www: http://www.metux.de/
fax: +49 36207 519932 email: contact(at)metux(dot)de
cellphone: +49 174 7066481
---------------------------------------------------------------------
-- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Marinos Yannikos | 2005-04-22 02:08:24 | Re: Odd error message (" hash indexes do not support whole-index |
Previous Message | Tony Wasson | 2005-04-22 01:21:27 | Looking for a way to sum integer arrays.... |