pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: SQL-standard function body
Date: Mon, 15 Mar 2021 16:03:44 +0800
Message-ID: <20210315080344.wed62yy54fuse7jg@nol> (raw)
In-Reply-To: <CAJKUy5j3N23=SuF=S=xX6mu8VX3N9qSbxiej2wMsAqZ3FB2Pow@mail.gmail.com>
References: <1c11f1eb-f00c-43b7-799d-2d44132c02d7@2ndquadrant.com>
	<0725f2a9-a4f9-87c3-dd47-e5aa24997ad9@2ndquadrant.com>
	<160502166422.7362.9550545869239240893.pgcf@coridan.postgresql.org>
	<59430371-e1c8-3ee8-7ef6-371eb1a00e7e@2ndquadrant.com>
	<e5996aab-a52c-40ad-543e-2fac3ecf31c3@2ndquadrant.com>
	<4b91051f-c090-532f-42f9-d901f9123f1e@2ndquadrant.com>
	<CAJKUy5i9hGy-uCGjqmG6T=0TjDbS0mw14sOssjiDVMd0aOTG1A@mail.gmail.com>
	<e14f620c-8e10-8103-e12d-657991c9dda7@2ndquadrant.com>
	<CAJKUy5j3N23=SuF=S=xX6mu8VX3N9qSbxiej2wMsAqZ3FB2Pow@mail.gmail.com>

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.





view thread (90+ messages)  latest in thread

Message-ID: <20210315080344.wed62yy54fuse7jg@nol>
Permalink:  ../20210315080344.wed62yy54fuse7jg@nol/
Also on:    postgresql.org/message-id/20210315080344.wed62yy54fuse7jg@nol

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: rjuju123@gmail.com, jcasanov@systemguards.com.ec, peter.eisentraut@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: SQL-standard function body
  In-Reply-To: <20210315080344.wed62yy54fuse7jg@nol>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox