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,
\<.