Re: Updates on Views? - Mailing list pgsql-general

From will trillich
Subject Re: Updates on Views?
Date
Msg-id 20010322220241.A15195@mail.serensoft.com
Whole thread Raw
In response to Re: Updates on Views?  (will trillich <will@serensoft.com>)
Responses Re: Updates on Views?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@serensoft.com
http://newbieDoc.sourceforge.net/ -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql slow connection
Next
From: Tom Lane
Date:
Subject: Re: How to inspect blocked queries