Re: Question about function body checking and 8.1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, 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:48:00
Message-ID: 10863.1111517280@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)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 carcter 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-03-22 19:05:29 Re: Changing constraints to deferrable
Previous Message Peter Eisentraut 2005-03-22 18:44:00 Re: Question about function body checking and 8.1