Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA25108; Fri, 2 Oct 92 09:22:54 -0700
Date: Fri, 2 Oct 92 09:22:54 -0700
Message-Id: <9210021622.AA25108@postgres.Berkeley.EDU>
From: Lance Gatrell (303) 977-2052 <gatrell@saturn.den.mmc.com>
Subject: Re: Can I do this
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu

> I looked at rules as a way to control this.
> But the docs say that rules can't have multiple POSTQUEL
> statements in the event of a retrieve and it's not clear
> that I can get it to execute C code at this point to do
> the update.

C code can do this.  Unfortunately, it has been our experience that
you can't pass a tuple to the function when the function is executed 
as the result of a rule (you can pass a tuple when calling the function
directly, just not when a rule calls the function).  So we pass the oid
of the tuple to the C function, and then retrieve the tuple through a portal.
Inside our C function we do some computations and then append several
records to another table.

I'm pretty confidant that you can do what you are talking about with
a C function, since you can access multiple tables (appends, retrieves,
etc.) through the C function.

Lance B. Gatrell
gatrell@den.mmc.com

