Re: The same result for with SPACE and without SPACE

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

@Tom Lane<mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>
Thanks for this email.
I am checking all the emails.
Sincerely,
Sarwar

________________________________
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: Wednesday, June 14, 2023 6:45 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 <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: 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://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.postgresql.org%2Fdocs%2Fcurrent%2Fdatatype-character.html&data=05%7C01%7C%7C10a23b4db34a484aa3cb08db6d291b28%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638223795537107272%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PMlQtWXS2OrzG%2FNZlFB3qGpKwKaTjnA4fsEQKFTVivk%3D&reserved=0<https://www.postgresql.org/docs/current/datatype-character.html>

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2023-06-15 17:16:53 Re: The same result for with SPACE and without SPACE
Previous Message Scott Ribe 2023-06-15 15:56:37 Re: The same result for with SPACE and without SPACE

Browse pgsql-advocacy by date

  From Date Subject
Next Message M Sarwar 2023-06-15 17:16:53 Re: The same result for with SPACE and without SPACE
Previous Message Scott Ribe 2023-06-15 15:56:37 Re: The same result for with SPACE and without SPACE