Re: Rules and Views - Mailing list pgsql-novice

From Tom Lane
Subject Re: Rules and Views
Date
Msg-id 26462.1002635859@sss.pgh.pa.us
Whole thread Raw
In response to Rules and Views  ("Travis Hoyt" <thoyt@npc.net>)
List pgsql-novice
"Travis Hoyt" <thoyt@npc.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

pgsql-novice by date:

Previous
From: "Travis Hoyt"
Date:
Subject: Rules and Views
Next
From: "Josh Berkus"
Date:
Subject: Re: JDBC ResultSet