Re: Rule causes baffling error

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Rule causes baffling error
Дата
Msg-id 43A67879.3050003@archonet.com
обсуждение исходный текст
Ответ на Rule causes baffling error  ("Ken Winter" <ken@sunward.org>)
Ответы Re: Rule causes baffling error  ("Ken Winter" <ken@sunward.org>)
Список pgsql-sql
Ken Winter wrote:
> This rule is supposed to (1) cause an update directed to the view
> "my_data_now" to be made to the underlying table "my_data", (2) reset the
> "effective_date_and_time" of that row to 'now', (3) insert a record
> containing the old values into "my_data", and (4) expire that "old" record
> by setting its "expiration_date_and_time" to 'now'.

I think you want a trigger rather than a rule.

Rules rewrite the query structure, triggers let you deal with values on 
a row-by-row basis (for row-level triggers).

--   Richard Huxton  Archonet Ltd


В списке pgsql-sql по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Does VACUUM reorder tables on clustered indices
Следующее
От: "Lane Van Ingen"
Дата:
Сообщение: How to Force Transactions to Process Serially on A Table