pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Anthony Chavez <acc@anthonychavez.org>
To: pgsql-sql@postgresql.org
Subject: Re: ON INSERT view rule
Date: Tue, 11 Jul 2006 06:56:31 -0600
Message-ID: <m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.org> (raw)
References: <m23bd8h0p7.fsf@pegasos.aegaeum.anthonychavez.org>

Anthony Chavez <acc@anthonychavez.org> writes:

> What I've got here are a couple of ON INSERT rules for a view.  The
> second rule is what I'm concerned about.  I wrote it with PostgreSQL's
> ACID compliance in mind, but can I trust it?

Oops, forgot to mention two things:

1. The addresses_address_lines view assumes that a row already exists
   in the addresses relation because that relation has some NOT NULL
   attributes that lack defaults.  Hence, there is no insert_addresses
   rule.  I suppose I should create one, but choosing a default value
   for some of the foreign keys in that relation would be difficult.

2. I have an AFTER INSERT trigger function on the addresses relation
   that inserts a default display_orderings tuple (with ordering = 0)
   and sets up the association in the junctions table.  Hence the use
   of UPDATE in the insert_display_orderings rule.

Cheers!

-- 
Anthony Chavez                                 http://anthonychavez.org/
mailto:acc@anthonychavez.org         jabber:acc@jabber.anthonychavez.org

view thread (2+ messages)

Message-ID: <m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.org>
Permalink:  ../m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.org/
Also on:    postgresql.org/message-id/m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.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: acc@anthonychavez.org
  Subject: Re: ON INSERT view rule
  In-Reply-To: <m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.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