Re: Question about function body checking and 8.1 - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Question about function body checking and 8.1
Date
Msg-id 200503221944.00883.peter_e@gmx.net
Whole thread Raw
In response to Re: Question about function body checking and 8.1  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Responses Re: Question about function body checking and 8.1
List pgsql-general
Alvaro Herrera wrote:
> On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote:
> > tony_caduto@amsoftwaredesign.com wrote:
> > > currently when you execute a CREATE OR REPLACE FUNCTION there is
> > > virtually no checking of the function body for variable type
> > > compatibility or if the SQL statements are valid.
> >
> > Only for very small values of "no".  Please provide an example.
>
> Here's a simple one:

Well, mentioning that he was talking about PL/pgSQL would have
helped. :)

Implementing this type of syntax checker isn't hard since the code is
already there, but there might be a small, ugly problem.  IIRC, the
parser and/or semantic analyzer of PL/pgSQL relies on knowing whether
the function is called as a trigger.  You don't know that at creation
phase.  So you'd need to relax the syntax checking in some ill-defined
ways and propagate that relaxation flag all over the place.  But
besides that, this is really just a typing exercise for someone.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Constraint problem
Next
From: Tom Lane
Date:
Subject: Re: Question about function body checking and 8.1