Skip site navigation (1) Skip section navigation (2)

Re: 8.1 and syntax checking at create time

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: 8.1 and syntax checking at create time
Date: 2005-08-31 18:59:47
Message-ID: 200508311159.47325.josh@agliodbs.com (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-hackers by date

Next:From: Tony CadutoDate: 2005-08-31 19:14:11
Subject: Re: 8.1 and syntax checking at create time
Previous:From: Michael FuhrDate: 2005-08-31 18:54:29
Subject: Re: 8.1 and syntax checking at create time

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group