Search Postgresql Archives

Rules UPDATE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux