pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Morozovsky <marck@rinet.ru>
To: pgsql-sql@postgresql.org
Subject: Trigger for updating view with join
Date: Wed, 4 Sep 2013 03:38:52 +0400 (MSK)
Message-ID: <alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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@FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru ***
------------------------------------------------------------------------


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (3+ messages)  latest in thread

Message-ID: <alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru>
Permalink:  ../alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru/
Also on:    postgresql.org/message-id/alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: marck@rinet.ru
  Subject: Re: Trigger for updating view with join
  In-Reply-To: <alpine.BSF.2.00.1309040335020.75311@woozle.rinet.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox