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

Re: WIP: pl/pgsql cleanup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: WIP: pl/pgsql cleanup
Date: 2005-02-10 04:57:07
Message-ID: 22925.1108011427@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Neil Conway <neilc(at)samurai(dot)com> writes:
> 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

That seems like a step backwards from the current behavior:

regression=# create function bad_sql1() returns int as $$
regression$# declare a int;
regression$# begin
regression$#     a := 5;
regression$#     Johnny Yuma;
regression$#     a := 10;
regression$#     return a;
regression$# end$$ language 'plpgsql';
CREATE FUNCTION
regression=# select bad_sql1();
ERROR:  syntax error at or near "Johnny" at character 1
QUERY:  Johnny Yuma
CONTEXT:  PL/pgSQL function "bad_sql1" line 4 at SQL statement
LINE 1: Johnny Yuma
        ^
regression=# 

While the difference in information content may not seem great, it is a
big deal when you are talking about a small syntax error in a large SQL
command spanning many lines.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Neil ConwayDate: 2005-02-10 05:00:22
Subject: Re: Clarify use of NOW() in pl/pgsql docs
Previous:From: Neil ConwayDate: 2005-02-10 04:27:10
Subject: Re: WIP: pl/pgsql cleanup

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