Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 42FDB2E0030; Tue, 15 Apr 2008 12:41:15 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 13865-06; Tue, 15 Apr 2008 12:41:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svana.org (svana.org [203.190.233.187]) by developer.postgresql.org (Postfix) with ESMTP id 2A73F2E0057; Tue, 15 Apr 2008 12:41:11 -0300 (ADT) Received: from kleptog by svana.org with local (Exim 4.63) (envelope-from ) id 1JlnHP-0002ac-Fo; Wed, 16 Apr 2008 01:41:07 +1000 Date: Tue, 15 Apr 2008 17:41:07 +0200 From: Martijn van Oosterhout To: Chad Showalter Cc: 'Robins Tharakan' , pgsql-sql@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: [SQL] rule for update view that updates/inserts into 2 tables Message-ID: <20080415154107.GE7024@svana.org> Reply-To: Martijn van Oosterhout References: <001501c89e4f$3be75340$b3b5f9c0$@net> <36af4bed0804141733t14d01791t1b7499ed3b986484@mail.gmail.com> <00a901c89f0d$306d7490$91485db0$@net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UnaWdueM1EBWVRzC" Content-Disposition: inline In-Reply-To: <00a901c89f0d$306d7490$91485db0$@net> X-PGP-Key-ID: Length=1024; ID=0x6F0B424C X-PGP-Key-Fingerprint: 34A8 8EAC F902 8C8D CA72 DCC7 201E DB34 6F0B 424C User-Agent: Mutt/1.5.13 (2006-08-11) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/1023 X-Sequence-Number: 117116 --UnaWdueM1EBWVRzC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 15, 2008 at 11:27:15AM -0400, Chad Showalter wrote: > I don't need to define the view the way I did in my example. I do need t= he > view to have fields that map to fields in my_audit_table in order to do an > insert into that table with values from the insert statement.=20 Right. > Here's one solution that seems to work. Change my view to the following, > leave rules the same as before: Looks good, though I would've used NULLs instead of actual values, but it doesn't matter. The reason I was asking about the SP is that you could do: SELECT insert_row(a,b,c); With the appropriate procedure definition and it would still have one roundtrip. But your way works also. Have a nice day, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > Please line up in a tree and maintain the heap invariant while=20 > boarding. Thank you for flying nlogn airlines. --UnaWdueM1EBWVRzC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIBMyTIB7bNG8LQkwRAt72AJ4gMhRy2iWOseSzioVbny2o/e81GQCdFmA3 4bCM1BkpHYM8ppnMIyc9sNY= =qzRl -----END PGP SIGNATURE----- --UnaWdueM1EBWVRzC--