Re: pgsql: SQL-standard function body

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: SQL-standard function body
Date: 2021-04-09 17:44:47
Message-ID: cee01d26fe55bc086b3bcf10bfe4e8d450e2f608.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, 2021-04-07 at 19:53 +0000, Peter Eisentraut wrote:
> SQL-standard function body
>
> This adds support for writing CREATE FUNCTION and CREATE PROCEDURE
> statements for language SQL with a function body that conforms to the
> SQL standard and is portable to other implementations.
>
> [...]
>
> 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.

Now you could argue that "case" is a reserved word, and I should
double quote it if I insist on using it as a FDW option, but it
is a regression.

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?

Yours,
Laurenz Albe

Attachment Content-Type Size
0001-Improve-psql-s-parsing-of-SQL-standard-function-bodi.patch text/x-patch 1.1 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2021-04-09 20:02:16 pgsql: doc: Additional documentation for date_bin
Previous Message Alvaro Herrera 2021-04-09 17:39:19 pgsql: Document ANALYZE storage parameters for partitioned tables