pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #15974: Concact with || doesn't work, but function CONCAT ()  works
2+ messages / 2 participants
[nested] [flat]

* BUG #15974: Concact with || doesn't work, but function CONCAT ()  works
@ 2019-08-23 11:16 PG Bug reporting form <noreply@postgresql.org>
  2019-08-23 18:09 ` Re: BUG #15974: Concact with || doesn't work, but function CONCAT () works David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2019-08-23 11:16 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: tessari@gmail.com

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) 
 ;



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #15974: Concact with || doesn't work, but function CONCAT () works
  2019-08-23 11:16 BUG #15974: Concact with || doesn't work, but function CONCAT ()  works PG Bug reporting form <noreply@postgresql.org>
@ 2019-08-23 18:09 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2019-08-23 18:09 UTC (permalink / raw)
  To: tessari@gmail.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

On Fri, Aug 23, 2019 at 4:17 AM PG Bug reporting form <
noreply@postgresql.org> wrote:

> 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');
>

In general most behaviors involving the "char" data type are what they are
and you can either accept them as-is or change to text to get more
logical/consistent behavior.

If you want a more in depth analysis of how char behaves in various
situations there are a number of posts in the archives where people have
taken the time to explain in detail what is happening.  Or someone may do
that here...but that someone isn't me.

If you want to claim these are buggy you'd need to point to documentation
that isn't being adhered to not just expectations.

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2019-08-23 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-08-23 11:16 BUG #15974: Concact with || doesn't work, but function CONCAT ()  works PG Bug reporting form <noreply@postgresql.org>
2019-08-23 18:09 ` Re: BUG #15974: Concact with || doesn't work, but function CONCAT () works David G. Johnston <david.g.johnston@gmail.com>

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