Re: WIP: pl/pgsql cleanup - Mailing list pgsql-patches

From Neil Conway
Subject Re: WIP: pl/pgsql cleanup
Date
Msg-id 1108009630.1286.142.camel@localhost.localdomain
Whole thread Raw
In response to Re: WIP: pl/pgsql cleanup  (Neil Conway <neilc@samurai.com>)
Responses Re: WIP: pl/pgsql cleanup
List pgsql-patches
Another version of the patch is attached. Changes:

- clean up grammar so that read_sql_construct() is always called to read
a well-formed SQL expression. That way we can check for errors in
embedded SQL by just adding a single function call to
read_sql_construct(), rather than adding calls at most of its call
sites.

- changed location of array overflow checks per Tom

- mostly fixed error message formatting for syntax errors in PL/PgSQL. I
found this part of the ereport() framework rather confusing. The patch
currently emits errors like:

create function bad_sql1() returns int as $$
declare a int;
begin
    a := 5;
    Johnny Yuma;
    a := 10;
    return a;
end$$ language 'plpgsql';
ERROR:  syntax error at or near "Johnny"
CONTEXT:  SQL statement embedded in PL/PgSQL function "bad_sql1" near
line 4

Any suggestions for improvement would be welcome.

Barring any objections, I'd like to apply this patch to HEAD tomorrow.

-Neil


Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: dbsize patch
Next
From: Tom Lane
Date:
Subject: Re: WIP: pl/pgsql cleanup