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 AE31F5349A for ; Thu, 21 Apr 2005 00:40:02 -0300 (ADT) 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 39497-10 for ; Thu, 21 Apr 2005 03:39:53 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 2481B53658 for ; Thu, 21 Apr 2005 00:39:50 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3L3dgb8033039 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Apr 2005 21:39:44 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3L3dfpL030836; Wed, 20 Apr 2005 21:39:41 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3L3defV030835; Wed, 20 Apr 2005 21:39:40 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 20 Apr 2005 21:39:40 -0600 From: Michael Fuhr To: Enrico Weigelt Cc: pgsql-sql Subject: Re: checking pgsql functions Message-ID: <20050421033939.GA18039@winnie.fuhr.org> References: <20050421023537.GB16782@nibiru.borg.metux.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050421023537.GB16782@nibiru.borg.metux.de> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/311 X-Sequence-Number: 21204 On Thu, Apr 21, 2005 at 04:35:37AM +0200, Enrico Weigelt wrote: > > Is it possible to check plpgsql functions before they're actually > into the database, as it's done w/ sql functions ? What version of PostgreSQL are you using? 8.0 and later have a validator function for PL/pgSQL, although its syntax checks are minimal and errors can still get through. I'm sure a patch that improves it would be welcome :-) > Often I've got the problem that a function still contains some > syntax errors (well, nobody's perfect), but my application is > quite critical (a single crashing trigger may cost a lot of money). > So I'd like to checkin only syntactically correct (also with > correct references). Since the application is critical, hopefully you're running regression tests in a non-production environment before modifying the production system. Is that not the case? Regardless of how much syntax checking the DBMS does, it would still be prudent to test as many code paths as possible for semantic correctness. -- Michael Fuhr http://www.fuhr.org/~mfuhr/