Rules UPDATE

From: Pailloncy Jean-Gerard <jg(at)rilk(dot)com>
To: Postgres mailing list general <pgsql-general(at)postgresql(dot)org>
Subject: Rules UPDATE
Date: 2005-08-22 11:45:57
Message-ID: 6E7F1347-37FA-4765-8370-E6FC92F8E014@rilk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Almeida do Lago 2005-08-22 11:55:00 OCFS released as GPL
Previous Message Laurent HERVE 2005-08-22 11:20:28 Question about expressions with raise plpgsql statement in coming 8.1