Rules UPDATE - Mailing list pgsql-general

From Pailloncy Jean-Gerard
Subject Rules UPDATE
Date
Msg-id 6E7F1347-37FA-4765-8370-E6FC92F8E014@rilk.com
Whole thread Raw
Responses Re: Rules UPDATE  (Gnanavel S <s.gnanavel@gmail.com>)
List pgsql-general
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);"

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


pgsql-general by date:

Previous
From: Laurent HERVE
Date:
Subject: Question about expressions with raise plpgsql statement in coming 8.1
Next
From: "Bruno Almeida do Lago"
Date:
Subject: OCFS released as GPL