Re: 8.1 and syntax checking at create time - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: 8.1 and syntax checking at create time
Date
Msg-id 200508311159.47325.josh@agliodbs.com
Whole thread Raw
In response to Re: 8.1 and syntax checking at create time  (Tony Caduto <tony_caduto@amsoftwaredesign.com>)
Responses Re: 8.1 and syntax checking at create time  (Matt Miller <mattm@epx.com>)
Re: 8.1 and syntax checking at create time  ("Jim C. Nasby" <jnasby@pervasive.com>)
List pgsql-hackers
Tony,

>  From what I have seen it does not check anything in the body of the
> function, I can put gibberish in the body as long as it has a begin and
> end.

Nope:

stp=# create function bad_stuff ( x boolean ) returns boolean as $x$
stp$# begin
stp$# afasdfasdfasdf;
stp$# afasdfasdfa;
stp$# asdfasfasdf;
stp$# end;
stp$# $x$ language plpgsql;
ERROR:  syntax error at or near "afasdfasdfasdf" at character 1
QUERY:  afasdfasdfasdf
CONTEXT:  SQL statement in PL/PgSQL function "bad_stuff" near line 2
ERROR:  syntax error at or near "afasdfasdfasdf" at character 1
QUERY:  afasdfasdfasdf
CONTEXT:  SQL statement in PL/PgSQL function "bad_stuff" near line 2
LINE 1: afasdfasdfasdf

Are you sure you don't have check_function_bodies = Off?

There is a  difference between *syntax* errors and *sql* errors.    If a 
table does not exist, we don't want to check for that and bounce the 
function; possibly the function will only be called in a context where the 
table does exist.

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco


pgsql-hackers by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: 8.1 and syntax checking at create time
Next
From: Tony Caduto
Date:
Subject: Re: 8.1 and syntax checking at create time