X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id A452E556EE for ; Thu, 10 Mar 2005 14:27:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37788-09 for ; Thu, 10 Mar 2005 14:27:49 +0000 (GMT) Received: from titan.internal (dsl093-203-229.ind1.dsl.speakeasy.net [66.93.203.229]) by svr1.postgresql.org (Postfix) with ESMTP id 445A3556EA for ; Thu, 10 Mar 2005 14:27:48 +0000 (GMT) Received: from [10.0.1.102] (helo=[10.0.1.102] ident=kris) by titan.internal with asmtp (Exim 4.34 #1 (Debian)) id 1D9Odi-0004Ip-KA for ; Thu, 10 Mar 2005 09:27:50 -0500 Message-ID: <42305968.10100@musicrebellion.com> Date: Thu, 10 Mar 2005 09:27:52 -0500 From: Kris Kiger User-Agent: Mozilla Thunderbird 0.9 (X11/20041103) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Pgsql-Admin (E-mail)" Subject: Re: Functions and transactions References: <421CF15C.6010306@turtle-entertainment.de> <421CF1CE.3000800@turtle-entertainment.de> <422F6203.1090800@musicrebellion.com> <7701.1110407641@sss.pgh.pa.us> In-Reply-To: <7701.1110407641@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/147 X-Sequence-Number: 16645 Hmm.. I was trying simplify my function to get the point across with minimal confusion. If you don't think there is enough detail, let me know what is lacking and I will add the appropriate detail. The function is executed BEFORE insert on table1. Thanks again for the help all Kris Tom Lane wrote: >Kris Kiger writes: > > >>Here is my problem. I have a function that is triggered on insert. For >>simplicity's sake, lets say the function looks like this: >> >> > > > >>CREATE OR REPLACE FUNCTION dostuff_on_insert() RETURNS TRIGGER AS ' >>DECLARE lockrows RECORD; >>BEGIN >> select into lockrows * from table1 where pkey_id = NEW.pkey_id for >>update on table1; >> update table1 set active = false where NEW.pkey_id = pkey_id and active; >> NEW.active := true; >>END; >>'language 'plpgsql'; >> >> > >This is awfully vague. What table is the trigger placed on? (If table1 >itself, seems like there are more efficient ways to do this.) What >events is the trigger fired for, and is it BEFORE or AFTER? > > regards, tom lane > >---------------------------(end of broadcast)--------------------------- >TIP 7: don't forget to increase your free space map settings > >