Re: Difference in text/char data matching between 7.3.4 & 7.4.2 - Mailing list pgsql-general

From Tom Lane
Subject Re: Difference in text/char data matching between 7.3.4 & 7.4.2
Date
Msg-id 2911.1089434956@sss.pgh.pa.us
Whole thread Raw
In response to Difference in text/char data matching between 7.3.4 & 7.4.2  (Kazuya Togashi <togashi@sra.co.jp>)
Responses Re: Difference in text/char data matching between 7.3.4
List pgsql-general
Kazuya Togashi <togashi@sra.co.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Slow deletion of data from tables
Next
From: Tom Lane
Date:
Subject: Re: max_fsm_pages