On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote:
> tony_caduto@amsoftwaredesign.com wrote:
> > currently when you execute a CREATE OR REPLACE FUNCTION there is
> > virtually no checking of the function body for variable type
> > compatibility or if the SQL statements are valid.
>
> Only for very small values of "no". Please provide an example.
Here's a simple one:
alvherre=# select version();
version
--------------------------------------------------------------------------------------------
PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.5 (Debian 1:3.3.5-12)
(1 fila)
alvherre=# create function test_syntax() returns void language plpgsql as 'begin zelect 1; return; end';
CREATE FUNCTION
alvherre=# select test_syntax();
ERROR: error de sintaxis en o cerca de «zelect» en el carácter 1
QUERY: zelect 1
CONTEXT: PL/pgSQL function "test_syntax" line 1 at SQL statement
LINEA 1: zelect 1
^
alvherre=#
One would think that this is a pretty obvious syntax error ...
--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
One man's impedance mismatch is another man's layer of abstraction.
(Lincoln Yeoh)