Trigger for updating view with join

From: Dmitry Morozovsky <marck(at)rinet(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Trigger for updating view with join
Date: 2013-09-03 23:38:52
Message-ID: alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear colleagues,

I'm running Pg 9.1 and have schema like the following:

create table machines (
mid serial not null primary key,
mname text not null unique
);

create table fs (
fsid serial not null primary key,
mid int not null references machines,
mpoint text not null
);
create unique index fs_mp on fs(mid, mpoint);

create view fsl as
select fsid,mid,mname,mpoint
from fs join machines using(mid);

Now, I want to create trigger so I can issue

insert into fsl (mname,mpoint) values ('server','/usr')

I understand I should use smth like

create trigger fsl_update instead of insert or update on fsl ...

but till now did not succeed in it. Quick googlink did not help either.

Could you point me to the right direction?

Thank you!

--
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: marck(at)FreeBSD(dot)org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck(at)rinet(dot)ru ***
------------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dmitry Morozovsky 2013-09-04 05:20:18 Re: Trigger for updating view with join
Previous Message walerina 2013-08-30 08:55:04 Re: Find Out a Way to Recover Data From Android Phone