Re: ON INSERT view rule - Mailing list pgsql-sql

From Anthony Chavez
Subject Re: ON INSERT view rule
Date
Msg-id m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.org
Whole thread Raw
In response to ON INSERT view rule  (Anthony Chavez <acc@anthonychavez.org>)
List pgsql-sql
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
hassome 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
(withordering = 0)  and sets up the association in the junctions table.  Hence the use  of UPDATE in the
insert_display_orderingsrule. 

Cheers!

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

pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: above the date functionssssssss
Next
From: Andrew Sullivan
Date:
Subject: Re: MS-SQL<->Postgres sync