Re: SQL-standard function body

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL-standard function body
Date: 2021-03-19 13:49:33
Message-ID: c17ea953-0837-70ab-b408-522421697d54@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 15.03.21 09:14, Julien Rouhaud wrote:
> On Mon, Mar 15, 2021 at 04:03:44PM +0800, Julien Rouhaud wrote:
>> On Mon, Mar 15, 2021 at 01:05:11AM -0500, Jaime Casanova wrote:
>>> I found another problem when using CASE expressions:
>>>
>>> CREATE OR REPLACE FUNCTION foo_case()
>>> RETURNS boolean
>>> LANGUAGE SQL
>>> BEGIN ATOMIC
>>> select case when random() > 0.5 then true else false end;
>>> END;
>>>
>>> apparently the END in the CASE expression is interpreted as the END of
>>> the function
>>
>> I think that it's an issue in psql scanner. If you escape the semicolon or
>> force a single query execution (say with psql -c), it works as expected.
>
> Applying the following diff (not sending a patch to avoid breaking the cfbot)
> the issue and doesn't seem to break anything else:

Right. Here is a new patch with that fix added and a small conflict
resolved.

Attachment Content-Type Size
v10-0001-SQL-standard-function-body.patch text/plain 96.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2021-03-19 13:54:16 Re: Feature improvement: can we add queryId for pg_catalog.pg_stat_activity view?
Previous Message Prabhat Sahu 2021-03-19 13:46:55 Re: [Patch] ALTER SYSTEM READ ONLY