Re: 8.1 and syntax checking at create time - Mailing list pgsql-hackers

From Tony Caduto
Subject Re: 8.1 and syntax checking at create time
Date
Msg-id 4315F32C.1020506@amsoftwaredesign.com
Whole thread Raw
In response to Re: 8.1 and syntax checking at create time  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: 8.1 and syntax checking at create time  (Matt Miller <mattm@epx.com>)
Re: 8.1 and syntax checking at create time  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: 8.1 and syntax checking at create time  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: 8.1 and syntax checking at create time  (Michael Fuhr <mike@fuhr.org>)
Re: 8.1 and syntax checking at create time  (Josh Berkus <josh@agliodbs.com>)
List 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@amsoftwaredesign.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
>
>  
>



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: On hardcoded type aliases and typmod for user types
Next
From: Matt Miller
Date:
Subject: Re: 8.1 and syntax checking at create time