Re: SQL-standard function body

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL-standard function body
Date: 2021-03-15 08:03:44
Message-ID: 20210315080344.wed62yy54fuse7jg@nol
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jürgen Purtz 2021-03-15 08:06:51 Re: Change JOIN tutorial to focus more on explicit joins
Previous Message Rafal Pietrak 2021-03-15 07:57:35 row level security (RLS)