From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Dave Trombley <dtrom(at)bumba(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org, Jan Wieck <JanWieck(at)Yahoo(dot)com> |
Subject: | Re: plpgsql and rowtypes |
Date: | 2002-01-02 05:20:39 |
Message-ID: | 2413.1009948839@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dave Trombley <dtrom(at)bumba(dot)net> writes:
> ... but it seems oddball that I wouldn't be
> griped at for putting some random words into my function (namely ELSIF).
A fair complaint, but the way plpgsql currently works is that any-random-
sentence-whatever is parsed as "unspecified SQL query". When and if
executed, it'll be fed down to the main SQL parser, which will spit up
on the unknown query keyword. But the way your function was formulated,
control could never get there. What plpgsql saw was
IF condition THEN
RETURN expr;
unspecified-SQL-query;
ELSE
something-else;
ENDIF;
and of course control never got past the RETURN to find out that the
unspecified-SQL-query was bogus.
This is not to suggest that the present behavior is adequate. plpgsql's
parser needs to be redesigned from the ground up so that it can detect
elementary syntax errors sooner. But I fear it's not a simple fix :-(
One possible improvement is for plpgsql's parser to feed
unspecified-SQL-queries to the main grammar (and no further)
during its syntax pass. Jan, any thoughts?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Trombley | 2002-01-02 05:51:36 | Re: plpgsql and rowtypes |
Previous Message | Dave Trombley | 2002-01-02 04:43:04 | Re: plpgsql and rowtypes |