new and old not available in rule subselects? - Mailing list pgsql-general

From Egil Möller
Subject new and old not available in rule subselects?
Date
Msg-id 4548C0A7.4020204@redhog.org
Whole thread Raw
Responses Re: new and old not available in rule subselects?  (Shane Ambler <pgsql@007Marketing.com>)
List 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

Attachment

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: What is causing 'canceling statement due to user
Next
From: None Known
Date:
Subject: Database engine poll