BUG #15974: Concact with || doesn't work, but function CONCAT () works

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: tessari(at)gmail(dot)com
Subject: BUG #15974: Concact with || doesn't work, but function CONCAT () works
Date: 2019-08-23 11:16:19
Message-ID: 15974-7722ea6a362abf3d@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15974
Logged by: Tessari Andrea
Email address: tessari(at)gmail(dot)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)
;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-08-23 14:58:14 Re: BUG #15964: vacuumdb.c:187:10: error: use of undeclared identifier 'FD_SETSIZE'
Previous Message Haleemur Ali 2019-08-23 05:04:59 Partial unique index not respected by insert on conflict statement