Function syntax checking - Mailing list pgsql-general

From Karim Nassar
Subject Function syntax checking
Date
Msg-id 1098656429.9589.355.camel@localhost
Whole thread Raw
Responses Re: Function syntax checking  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I am writing functions and I find it curious that CREATE FUNCTION does
not do syntax checking.

Example:

test=# CREATE FUNCTION foo(INTEGER) RETURNS BOOLEAN
test-# AS 'this is total crap' LANGUAGE plpgsql;
CREATE FUNCTION
test=# select foo(1);
ERROR:  syntax error at or near "this"
CONTEXT:  compile of PL/pgSQL function "foo" near line 1

The statement itself is valid, but the function causes runtime syntax
errors. Seems like one could run the interpreter with bogus, but
syntactically correct arguments to the function, creating the
instruction tree. Then run through the tree and try to create execution
plans for all the statements. The cost of this would be well worth *my*
time ;-)

Is there a technical reason this doesn't happen?

TIA,
\<.



pgsql-general by date:

Previous
From: stig erikson
Date:
Subject: Re: The data directory was initialized by PostgreSQL version 7.3,
Next
From: Karim Nassar
Date:
Subject: Re: Bug or stupidity