Re: review: psql: edit function, show function commands patch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
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 02:46:41
Message-ID: 25003.1280630801@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> I took a look at this tonight and am a bit mystified by the following bit:

> + /*
> + * PL doesn't calculate first row of function's body
> + * when first row is empty. So checks first row, and
> + * correct lineno when it is necessary.
> + */

> Is that true of any PL, or just some particular PL?

plpgsql has an old bit of logic that deliberately ignores an initial
newline in the function body:

/*----------
* Hack: skip any initial newline, so that in the common coding layout
* CREATE FUNCTION ... AS $$
* code body
* $$ LANGUAGE plpgsql;
* we will think "line 1" is what the programmer thinks of as line 1.
*----------
*/
if (*cur_line_start == '\r')
cur_line_start++;
if (*cur_line_start == '\n')
cur_line_start++;

None of the other standard PLs do that AFAIK.

> Is it documented in our documentation?

I don't think so.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-08-01 03:15:45 Re: ANALYZE versus expression indexes with nondefault opckeytype
Previous Message Tom Lane 2010-08-01 02:31:47 Re: rbtree code breaks GIN's adherence to maintenance_work_mem