Re: Rules UPDATE - Mailing list pgsql-general

From Gnanavel S
Subject Re: Rules UPDATE
Date
Msg-id eec3b03c05082205253652d690@mail.gmail.com
Whole thread Raw
In response to Rules UPDATE  (Pailloncy Jean-Gerard <jg@rilk.com>)
List pgsql-general


On 8/22/05, Pailloncy Jean-Gerard <jg@rilk.com> wrote:
Hi,

With PostgreSQL 7.4.6.

I have a table aaa (id serial, maj timestamp without time zone)
I defined to function from_timestamp and to_timestamp to do
conversion between text and timestamp with few checks and tricks.

I defined a view aab (id serial, maj text) as "SELECT id,
from_timestamp(maj) AS maj FROM aaa;"
I defined a rule UPDATE on aab as "CREATE RULE aab_update AS ON
UPDATE TO aab DO INSTEAD UPDATE aaa SET id = new.id, maj =
to_timestamp(new.maj);"

add the foll. where condition in rule
   where id=new.id

Now, when I do
UPDATE aab SET maj='1990-00-00' WHERE id<9
all the rows of aaa are updated. The condition "id<9" is not used.

Any help is welcome.

Cordialement,
Jean-Gérard Pailloncy


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings



--
with regards,
S.Gnanavel
Satyam Computer Services Ltd.

pgsql-general by date:

Previous
From: Bernard
Date:
Subject: SQL error - please help.
Next
From: Sean Davis
Date:
Subject: Re: SQL error - please help.