pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Seb <spluque@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: updateable/insertable view having left joined tables
Date: Fri, 12 Jun 2009 19:22:27 -0500
Message-ID: <87iqj1t22k.fsf@kolob.sebmags.homelinux.org> (raw)
References: <87prd9t9te.fsf@kolob.sebmags.homelinux.org>

The following seems to work, but I don't feel confident this is really
the correct code:

CREATE RULE shoe_upd AS
    ON UPDATE TO shoe
    DO INSTEAD (
    UPDATE shoes
    SET sh_name = NEW.sh_name, sh_avail = NEW.sh_avail
    WHERE shoes.sh_id = NEW.sh_id;
    INSERT INTO shoelaces (sh_id, sl_name)
    SELECT New.sh_id, New.sl_name WHERE New.sl_name IS NOT NULL;);

I could find out doing a number of tests, but it would be good to
understand what is going on.

-- 
Seb




view thread (2+ messages)

Message-ID: <87iqj1t22k.fsf@kolob.sebmags.homelinux.org>
Permalink:  ../87iqj1t22k.fsf@kolob.sebmags.homelinux.org/
Also on:    postgresql.org/message-id/87iqj1t22k.fsf@kolob.sebmags.homelinux.org

 · 

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: spluque@gmail.com
  Subject: Re: updateable/insertable view having left joined tables
  In-Reply-To: <87iqj1t22k.fsf@kolob.sebmags.homelinux.org>

* 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