new and old not available in rule subselects?

From: Egil Möller <redhog(at)redhog(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: new and old not available in rule subselects?
Date: 2006-11-01 15:43:35
Message-ID: 4548C0A7.4020204@redhog.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
redhog.vcf text/x-vcard 199 bytes

Responses

Browse pgsql-general by date

  From Date Subject
Next Message None Known 2006-11-01 16:37:41 Database engine poll
Previous Message Tom Lane 2006-11-01 15:26:02 Re: Encoding, Unicode, locales, etc.