Function syntax checking

From: Karim Nassar <Karim(dot)Nassar(at)NAU(dot)EDU>
To: pgsql-general(at)postgresql(dot)org
Subject: Function syntax checking
Date: 2004-10-24 22:20:29
Message-ID: 1098656429.9589.355.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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,
\<.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2004-10-24 22:55:01 Re: Slony-I 1.0.4 Released
Previous Message Devrim GUNDUZ 2004-10-24 21:37:27 (S)RPMs for PostgreSQL 7.2.6, 7.3.8 and 7.4.6 are ready