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

From Tom Lane
Subject Re: Question about function body checking and 8.1
Date
Msg-id 10863.1111517280@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about function body checking and 8.1  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List pgsql-general
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> alvherre=# create function test_syntax() returns void language plpgsql as 'begin zelect 1; return; end';
> CREATE FUNCTION
> alvherre=# select test_syntax();
> ERROR:  error de sintaxis en o cerca de �zelect� en el car�cter 1
> QUERY:  zelect 1
> CONTEXT:  PL/pgSQL function "test_syntax" line 1 at SQL statement
> LINEA 1: zelect 1
>          ^
> alvherre=#

Of course, Neil fixed that one already.  It's still true that plpgsql
doesn't do any *semantic* analysis to speak of at function definition
time.  I gather that Tony's users are looking for more than bare syntax
checking.

I'm not sure how much we could really do though; the obvious idea of
trying to test-plan each query in the function will fail on cases like

    begin
        create temp table foo ...;
        insert into foo ...;

(And before you object that that doesn't work anyway, it probably will
once Neil gets done with cached-plan invalidation.)

            regards, tom lane

pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Question about function body checking and 8.1
Next
From: Tom Lane
Date:
Subject: Re: Changing constraints to deferrable