new and old not available in rule subselects?

Поиск
Список
Период
Сортировка
От Egil Möller
Тема new and old not available in rule subselects?
Дата
Msg-id 4548C0A7.4020204@redhog.org
обсуждение исходный текст
Ответы Re: new and old not available in rule subselects?  (Shane Ambler <pgsql@007Marketing.com>)
Список pgsql-general
It seems like you can not use the magical relations new and old in
sub-selects in rules. Why is this, or is there something I haven't
understood correctly about rules and new and old?

create table "user" (
 username varchar,
 created timestamp  default now(),
 detstroyed timestamp default null);

create table users (
 time timestamp,
 users bigint);

create rule user_insert_count as
 on update to "user"
 do also
  select
   new.created, (select count(*) from new where destroyed is null)
  into users
  from new;

ERROR:  relation "*NEW*" does not exist

Thanks in advance,
Egil

Вложения

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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: What is causing 'canceling statement due to user
Следующее
От: None Known
Дата:
Сообщение: Database engine poll