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

Browse pgsql-hackers by date

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