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