Re: pgsql: SQL-standard function body

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: pgsql: SQL-standard function body
Дата
Msg-id 823c7393-a2ca-c44a-c57a-b5ff84c3de28@enterprisedb.com
обсуждение исходный текст
Ответ на pgsql: SQL-standard function body  (Peter Eisentraut <peter@eisentraut.org>)
Список pgsql-committers
On 10.04.21 03:38, Laurenz Albe wrote:
> On Fri, 2021-04-09 at 19:44 +0200, I wrote:
>>> SQL-standard function body
>>>
>>> psql needs some new intelligence to keep track of function body
>>> boundaries so that it doesn't send off statements when it sees
>>> semicolons that are inside a function body.
>>
>> This causes psql to fail to recognize the semicolon in the following
>> statement as the end of a statement:
>>
>>    IMPORT FOREIGN SCHEMA x FROM SERVER y INTO z OPTIONS (case 'lower');
>>
>> The cause is the "case", which is recognized as the start of a function
>> body.
>>
>> Would it be an option to recognize BEGIN and CASE as starting a
>> function body only if they are *not* inside parentheses, like in
>> the attached?
> 
> Here is an improved patch, which treats END in the same fashion
> (not properly indented for readability).

Thanks, I took another look at this and augmented your change with a 
change that tracks whether the statement starts with CREATE [OR REPLACE] 
{FUNCTION|PROCEDURE}.  That should make it pretty safe.  What do you think?

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Silence some Coverity warnings and improve code consistency.
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: pg_amcheck: Add basic NLS support