Re: ON INSERT view rule

From: Anthony Chavez <acc(at)anthonychavez(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: ON INSERT view rule
Date: 2006-07-11 12:56:31
Message-ID: m2odvwfgg0.fsf@pegasos.aegaeum.anthonychavez.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Anthony Chavez <acc(at)anthonychavez(dot)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(at)anthonychavez(dot)org jabber:acc(at)jabber(dot)anthonychavez(dot)org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2006-07-11 13:17:40 Re: MS-SQL<->Postgres sync
Previous Message Michael Fuhr 2006-07-11 12:10:21 Re: above the date functionssssssss