Re: plpgsql and rowtypes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpgsql and rowtypes
Дата
Msg-id 2413.1009948839@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: plpgsql and rowtypes  (Dave Trombley <dtrom@bumba.net>)
Список pgsql-general
Dave Trombley <dtrom@bumba.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Dave Trombley
Дата:
Сообщение: Re: plpgsql and rowtypes
Следующее
От: William WAISSE
Дата:
Сообщение: Re: libpq: possible to get list of tables, fields, and types?