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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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