Search Postgresql Archives

new and old not available in rule subselects?

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

 



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
begin:vcard
fn;quoted-printable:Egil M=C3=B6ller
n;quoted-printable:M=C3=B6ller;Egil
email;internet:redhog@xxxxxxxxxx
tel;cell:+46-(0)709-707207
url:http://redhog.org
version:2.1
end:vcard

Attachment: signature.asc
Description: OpenPGP digital signature


[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