Re: review: psql: edit function, show function commands patch
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Jan Urbański <wulczer@wulczer.org>, Postgres - Hackers <pgsql-hackers@postgresql.org>
Date: 2010-08-01T02:46:41Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.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