From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: review: psql: edit function, show function commands patch |
Date: | 2010-08-01 17:28:23 |
Message-ID: | AANLkTinp+oNO6hKuaUWOLpjphk6OpmvjQE4RHw3ccRRU@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Aug 1, 2010 at 11:35 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Sun, Aug 1, 2010 at 10:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> The need to count lines manually in function definitions is
>>> far less than it was back when that kluge was put in.
>
>> Why?
>
> That hack goes back to plpgsql's prehistory (it's there, though sans
> comment, in plpgsql's scan.l 1.1). We had none of the current support
> for identifying error locations by cursor position and/or quoting part
> of the source text back at you. Let me illustrate what happened with
> a simple syntax error in PG 7.0:
>
> play=> create function fool() returns int as '
> play'> begin
> play'> fool
> play'> end' language 'plpgsql';
> CREATE
> play=> select fool();
> NOTICE: plpgsql: ERROR during compile of fool near line 2
> ERROR: missing ; at end of SQL statement
> play=>
>
> So you *had* to count lines, and do it accurately too, to figure out
> even pretty simple syntax errors.
>
> Personally, rather than sweat about what the exact definition of line
> numbers is, I think we should be moving further in the direction of
> being able to regurgitate source text to identify error locations.
I basically agree with that; but on the other hand, in a large
PL/pgsql function, you may have very similar-looking text in multiple
places. So line numbers are good, too: but then you weren't proposing
to remove those, I assume, just to augment them with additional
information.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Sushant Sinha | 2010-08-01 18:04:36 | english parser in text search: support for multiple words in the same position |
Previous Message | Tom Lane | 2010-08-01 15:54:33 | Re: ANALYZE versus expression indexes with nondefault opckeytype |