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

Re: WIP: pl/pgsql cleanup

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: WIP: pl/pgsql cleanup
Date: 2005-02-10 04:27:10
Message-ID: 1108009630.1286.142.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: 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: plpgsql_cleanup-26.patch.gz
Description: application/x-gzip (23.5 KB)

In response to

Responses

pgsql-patches by date

Next:From: Tom LaneDate: 2005-02-10 04:57:07
Subject: Re: WIP: pl/pgsql cleanup
Previous:From: Bruce MomjianDate: 2005-02-10 02:59:11
Subject: Re: dbsize patch

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