X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3F4C19FA5BF for ; Tue, 11 Jul 2006 09:56:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 42131-08 for ; Tue, 11 Jul 2006 09:56:43 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id CC5D29FA5B5 for ; Tue, 11 Jul 2006 09:56:43 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1G0Hn7-0000CG-Dg for pgsql-sql@postgresql.org; Tue, 11 Jul 2006 14:56:41 +0200 Received: from anthonychavez.org ([166.70.126.66]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Jul 2006 14:56:41 +0200 Received: from acc by anthonychavez.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Jul 2006 14:56:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Anthony Chavez Subject: Re: ON INSERT view rule Date: Tue, 11 Jul 2006 06:56:31 -0600 Lines: 43 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: anthonychavez.org User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Cancel-Lock: sha1:GxbfFiuI7ElhWYrnlWRgkRztuwA= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/177 X-Sequence-Number: 25751 --=-=-= Content-Transfer-Encoding: quoted-printable Anthony Chavez 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 =3D 0) and sets up the association in the junctions table. Hence the use of UPDATE in the insert_display_orderings rule. Cheers! =2D-=20 Anthony Chavez http://anthonychavez.org/ mailto:acc@anthonychavez.org jabber:acc@jabber.anthonychavez.org --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (Darwin) iQEVAwUBRLOgAvAIdTFWAbdTAQI/Dwf/WjBAsvRtnmdWO4fB9zxma+bWE3G8LsCn 77pwD3BI6cOC8CREHV16s6zpojwRNTuk7pYaHAzlWQAeiwh+rNBajQjusF1RX8xl R0SLk8rt2qFCbv5nxH5NaIFkYCm/0p+uXVyOWRdk93xCxLw/O5NGwtrGF0Dbwiyp ZK2n7n7eG8mUwi68kH3eoBt3Tsj3mYQWlgoDGyFWhzoJmcw7s4UO37akKiW4V8YW 2KTCuxrJIA8EpExihx/C26ehONdBXqoysfwbpnq2mpOM6Fc0mth/JUMMcIbHV/zu HSS8GN+IFEI1YSs1Ll+eTZMfLpymz4dkvQ3vPh0s5SZSR8XxPtEEIw== =tmW2 -----END PGP SIGNATURE----- --=-=-=--