X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 44B5153B28 for ; Fri, 8 Apr 2005 14:42:39 +0100 (BST) 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 15770-10 for ; Fri, 8 Apr 2005 13:42:36 +0000 (GMT) Received: from mx5.net.nih.gov (mailfwd.nih.gov [165.112.130.36]) by svr1.postgresql.org (Postfix) with ESMTP id D27B253A95 for ; Fri, 8 Apr 2005 14:42:34 +0100 (BST) Received: from mx5.net.nih.gov (localhost [127.0.0.1]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j38Dgbau007998 for ; Fri, 8 Apr 2005 09:42:38 -0400 Received: from [128.231.145.14] (holmes.nhgri.nih.gov [128.231.145.14]) by mx5.net.nih.gov (8.12.10/8.11.6) with ESMTP id j38DgbKd007995; Fri, 8 Apr 2005 09:42:37 -0400 In-Reply-To: References: <4255AA15.8000508@mochima.com> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Carlos Moreno , pgsql-sql@postgresql.org From: Sean Davis Subject: Re: Question on triggers and plpgsql Date: Fri, 8 Apr 2005 09:41:57 -0400 To: John DeSoi X-Mailer: Apple Mail (2.619.2) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/87 X-Sequence-Number: 20980 On Apr 8, 2005, at 8:28 AM, John DeSoi wrote: > > On Apr 7, 2005, at 5:45 PM, Carlos Moreno wrote: > >> The thing seems to work -- I had to go in a shell as user >> postgres and execute the command: >> >> $ createlang -d dbname plpgsql >> >> (I'm not sure I understand why that is necessary, or >> what implications -- positive or negative -- it may have) > > As a security measure, no pl language is available by default. What > you did is correct. There is not much (any?) risk with pl/pgsql, so > you can install it in template1 so it will be available in any new > database you create. > >> >> Am I doing the right thing? Have I introduced some sort >> of catastrophe waiting to happen? > > I did not notice any problems. > Just one detail, but in the form of a question. In the original posting, I think the trigger was doing the logging for something happening on a table as a before insert or update--I may be wrong on that detail. I would think of doing such actions AFTER the update/insert. In the world of transaction-safe operations, is there ANY danger in doing the logging as a BEFORE trigger rather than an AFTER trigger? Thanks, Sean