Re: Difference in text/char data matching between 7.3.4

From: Kazuya Togashi <togashi(at)sra(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Difference in text/char data matching between 7.3.4
Date: 2004-07-12 09:18:23
Message-ID: 40F2575F.5050206@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

Thanks for your input. So if I understand you correctly, it is implied
that the behavior with PostgreSQL 7.3.4 is likely to be incorrect (or it
was a bug, I guess?)

One more question, in your reply, you mentioned that "char" type
considers trailing spaces to be insignificant. Should this idea be
applied to both how "char" type holds whitespaces and how equal operator
works on "char" type?

Thanks,
Kazuya

Tom Lane wrote:

> Kazuya Togashi <togashi(at)sra(dot)co(dot)jp> writes:
>
>>With version 7.3.4, following query returns true, but with version 7.4.2
>>it returns false.
>
>
>> select ' '::text = ' '::char;
>
>
> Offhand that seems like a step forward to me. "char" type considers
> trailing spaces to be insignificant, so it is really correct to consider
> that ' '::char is equivalent to ''::text, not ' '::text which represents
> a single significant space.
>
> If you do not like this behavior, I suggest casting your text input to
> char so that the comparison will occur under char rules not text rules.
>
> regards, tom lane
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2004-07-12 10:56:46 Re: help required
Previous Message Peter Eisentraut 2004-07-12 08:29:04 Re: Help needed on time data types