The same result for with SPACE and without SPACE

From: "Wetmore, Matthew (CTR)" <Matthew(dot)Wetmore(at)express-scripts(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>, "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: The same result for with SPACE and without SPACE
Date: 2023-06-15 13:08:06
Message-ID: 0055148e2cc742cbbc23485ae0c6c04e@express-scripts.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-advocacy

I can reproduce this with a INT

-----Original Message-----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Wednesday, June 14, 2023 3:46 PM
To: M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>; pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: [EXTERNAL] Re: The same result for with SPACE and without SPACE

M Sarwar <sarwarmd02(at)outlook(dot)com> writes:
> I expect this to behave the same way whether it comes from CHAR or VARCHAR.

You expect incorrectly. CHAR comparison is insensitive to trailing
spaces:

https://urldefense.com/v3/__https://www.postgresql.org/docs/current/datatype-character.html__;!!GFE8dS6aclb0h1nkhPf9!5ahVPSTPuRxIvywc-UhqjYfqPmkGYEBT5b4GYndHqVaD0G98F0LrX6G6GgTNaJsMVaewVB5e1wox__K0nNGLZsEilYBU$

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2023-06-15 13:38:36 Re: The same result for with SPACE and without SPACE
Previous Message Scott Ribe 2023-06-14 22:54:50 Re: The same result for with SPACE and without SPACE

Browse pgsql-advocacy by date

  From Date Subject
Next Message Scott Ribe 2023-06-15 13:38:36 Re: The same result for with SPACE and without SPACE
Previous Message Scott Ribe 2023-06-14 22:54:50 Re: The same result for with SPACE and without SPACE