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

Re: 8.1 and syntax checking at create time

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>,PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 8.1 and syntax checking at create time
Date: 2005-08-31 18:13:00
Message-ID: 4315F32C.1020506@amsoftwaredesign.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom,
What exactly does it check then? What I pointed out is simple "syntax" 
checking in other languages.

 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.

It does not seem to be doing anything differently than 8.0.x does with 
function syntax checking at create time, so why even mention it in the 
release notes?

the function below also raises no errors at create, but at run time it does.

If I run the below function I get this error:

PostgreSQL Error Code: (1)
ERROR:  type "record44" does not exist

 From what I read in the release notes I was expecting to see this 
raised at create time. 
Users coming from systems like Oracle and M$ SQL server are expecting 
this stuff to be caught at create not run time.

How difficult would it be to have the server just run the function at 
create time with null for any input params?  Of course a user could just 
do this but it is a annoying second step.

CREATE or REPLACE FUNCTION public.test_func9(out firstname varchar,out 
lastname varchar)
RETURNS SETOF pg_catalog.record AS
$BODY$
Declare
row record44;
BEGIN
    asfdfdfdfafdsfsdfsdf
    sdf bla bla
    sdf yada yada
    s
    df
    sd
    fsd
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

Thanks,

Tony

Tom Lane wrote:

>Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com> writes:
>  
>
>>notice the for in select, it's for sure wrong, but it raises no errors 
>>until I execute the function
>>also note the declaration for row, there is no record56 type, but it 
>>raises no errors at create.
>>    
>>
>
>It's *syntax* checking, not an exhaustive check that the function is OK.
>
>			regards, tom lane
>
>  
>


In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-08-31 18:25:54
Subject: Re: On hardcoded type aliases and typmod for user types
Previous:From: Martijn van OosterhoutDate: 2005-08-31 17:59:10
Subject: Re: On hardcoded type aliases and typmod for user types

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