Re: Rules and Views

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Travis Hoyt" <thoyt(at)npc(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Rules and Views
Date: 2001-10-09 13:57:39
Message-ID: 26462.1002635859@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"Travis Hoyt" <thoyt(at)npc(dot)net> writes:
> create rule ins_sun_u as on insert
> to sun_u do instead insert into sardata values ( usr, sys, wio,
> idle, time, systemid );
> ERROR: Attribute 'usr' not found

You need to write "new.usr", etc. Essentially, "new" and "old" are
record variables referring to the about-to-be-inserted row (in INSERT
or UPDATE rules) and the about-to-be-deleted row (in UPDATE or DELETE).
Even though sun_u is a view not a real table, you still have to follow
the syntax...

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Herb Blacker 2001-10-09 15:09:21 Loading current_user and current_timestamp using COPY
Previous Message Travis Hoyt 2001-10-09 13:24:26 Rules and Views