Re: Updates on Views?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Updates on Views?
Date: 2001-03-23 04:02:41
Message-ID: 20010322220241.A15195@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 22, 2001 at 07:14:49PM -0600, will trillich wrote:
> CREATE VIEW who AS
> SELECT * from _who;
>
> CREATE RULE
> who_insert
> AS ON
> INSERT TO who
> DO INSTEAD
> INSERT INTO "_who" (
> login,
> "password",
> hint,
> name,
> email,
> editor,
> status,
> modified,
> created,
> id
> ) VALUES (
> NEW.login,
> NEW."password",
> NEW.hint,
> NEW.name,
> NEW.email,
> NEW.editor,
> 'U'::bpchar, -- uncertain until confirmed
> "timestamp"('now'::text), -- last mod
> "timestamp"('now'::text), -- created now
> nextval('_who_id_seq'::text)
> );
> -- all non-mentioned fields from _who are silently
> -- ignored (and dropped).

now that i think about it...

is it possible to have a rule DO INSTEAD more-than-one-thing?

create rule split_it as
on insert to someview
do instead
insert into tableone ....
then
intert into tabletwo ....
then
insert into tablethree ...
then
update someothertable ...

--
It is always hazardous to ask "Why?" in science, but it is often
interesting to do so just the same.
-- Isaac Asimov, 'The Genetic Code'

will(at)serensoft(dot)com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-03-23 04:05:17 Re: How to inspect blocked queries
Previous Message Mark Knox 2001-03-23 03:49:02 Re: Call for platforms