Re: [pgsql-advocacy] Oracle buys Innobase

From: Doug Quale <quale1(at)charter(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: [pgsql-advocacy] Oracle buys Innobase
Date: 2005-10-20 20:29:22
Message-ID: 878xwokk4d.fsf@charter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"Guy Rouillier" <guyr(at)masergy(dot)com> writes:

> Doug Quale wrote:
>>
>> # select 'a'::char(8) = 'a '::char(8);
>> ?column?
>> ----------
>> t
>> (1 row)
>>
>> Trailing blanks aren't significant in fixed-length strings, so the
>> question is whether Postgresql treats comparison of varchars right.
>
> This result is being misinterpreted.
>
> select length('a'::char(8)) ==> 1
> select length('a '::char(8)) ==> 1
>
> So it isn't that the two different strings are comparing equal. The
> process of casting them to char(8) is trimming the blanks, so by the
> time they become fixed length strings, they are indeed equal.

Huh??? What version of PG are you using? On 7.4.9,

test=# select length('a'::char(8));
length
--------
8
(1 row)

test=# select length('a '::char(8));
length
--------
8
(1 row)

The truncation you describe would simply be wrong.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2005-10-20 20:47:42 Re: Select all invalid e-mail addresses
Previous Message Dann Corbit 2005-10-20 20:19:21 Re: Select all invalid e-mail addresses

Browse pgsql-sql by date

  From Date Subject
Next Message gurkan 2005-10-20 22:02:00 SQL Functions
Previous Message Chris Travers 2005-10-20 18:31:40 Re: pg, mysql comparison with "group by" clause