| From: | Peter Eisentraut <peter_e(at)gmx(dot)net> | 
|---|---|
| To: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> | 
| Cc: | tony_caduto(at)amsoftwaredesign(dot)com, pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Question about function body checking and 8.1 | 
| Date: | 2005-03-22 18:44:00 | 
| Message-ID: | 200503221944.00883.peter_e@gmx.net | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Alvaro Herrera wrote:
> On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote:
> > tony_caduto(at)amsoftwaredesign(dot)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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2005-03-22 18:48:00 | Re: Question about function body checking and 8.1 | 
| Previous Message | Tom Lane | 2005-03-22 18:24:07 | Re: Constraint problem |