Re: The same result for with SPACE and without SPACE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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
Date: 2023-06-14 22:45:39
Message-ID: 2018059.1686782739@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-advocacy

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://www.postgresql.org/docs/current/datatype-character.html

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2023-06-14 22:47:21 Re: The same result for with SPACE and without SPACE
Previous Message M Sarwar 2023-06-14 22:31:34 Re: The same result for with SPACE and without SPACE

Browse pgsql-advocacy by date

  From Date Subject
Next Message Scott Ribe 2023-06-14 22:47:21 Re: The same result for with SPACE and without SPACE
Previous Message M Sarwar 2023-06-14 22:31:34 Re: The same result for with SPACE and without SPACE