Re: Question about function body checking and 8.1

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: tony_caduto(at)amsoftwaredesign(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Question about function body checking and 8.1
Date: 2005-03-22 17:23:11
Message-ID: 20050322172310.GA16109@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Mar 22, 2005 at 06:09:28PM +0100, Peter Eisentraut wrote:
> tony_caduto(at)amsoftwaredesign(dot)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[(at)]dcc(dot)uchile(dot)cl>)
One man's impedance mismatch is another man's layer of abstraction.
(Lincoln Yeoh)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2005-03-22 17:48:02 Re: pg_dump fails with socket_not_open
Previous Message Richard Huxton 2005-03-22 17:15:47 Re: Question about function body checking and 8.1