From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: tessari@gmail.com
Subject: BUG #15974: Concact with || doesn't work, but function CONCAT () works
Date: Fri, 23 Aug 2019 11:16:19 +0000
Message-ID: <15974-7722ea6a362abf3d@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15974
Logged by: Tessari Andrea
Email address: tessari@gmail.com
PostgreSQL version: 11.4
Operating system: linux - Red Hat 7.6
Description:
Example.
( I test on postgres 11.4 and postgres 10.9 (edb) )
create table AA3 (CLIV CHAR(2), SSTT CHAR(1));
INSERT INTO AA3 (CLIV,SSTT) VALUES (' ','2');
COMMIT;
---errore expect "A Z" --> result "AZ"
select 'A'||(CASE WHEN J01.CLIV = ' ' THEN ' '
ELSE J01.CLIV END)||'Z' as X
from AA3 J01;
---errore expect "A "--> result "A"
select 'A'||(CASE WHEN J01.CLIV = ' ' THEN ' '
ELSE J01.CLIV
END) as X
from AA3 J01;
---errore expect " Z"--> result "Z"
select (CASE WHEN J01.CLIV = ' ' THEN ' '
ELSE J01.CLIV
END)||'Z' as X
from AA3 J01;
--WORKS - show " "--> result " "
select
(CASE WHEN J01.CLIV = ' ' THEN ' '
ELSE J01.CLIV
END) as X
from AA3 J01;
-- WORKS
select 'A'||(CASE WHEN CLIV = ' ' THEN ' ' ELSE ' ' END)||'Z' from AA3
;
-- WORKS
select CONCAT ('A', x,'Z') FROM
(SELECT CASE WHEN CLIV = ' ' THEN ' ' ELSE CLIV END AS X from AA3)
;
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, tessari@gmail.com
Subject: Re: BUG #15974: Concact with || doesn't work, but function CONCAT () works
In-Reply-To: <15974-7722ea6a362abf3d@postgresql.org>
References: <15974-7722ea6a362abf3d@postgresql.org>
* 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