Re: Difference in text/char data matching between 7.3.4 & 7.4.2

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

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-07-10 06:03:34 Re: max_fsm_pages
Previous Message Tom Lane 2004-07-10 04:41:20 Re: Slow deletion of data from tables