pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Doug Quale <quale1@charter.net>
To: pgsql-general@postgresql.org
Subject: Re: [pgsql-advocacy] Oracle buys Innobase
Date: Thu, 20 Oct 2005 15:29:22 -0500
Message-ID: <878xwokk4d.fsf@charter.net> (raw)
In-Reply-To: <CC1CF380F4D70844B01D45982E671B239E8BEC@mtxexch01.add0.masergy.com>
References: <CC1CF380F4D70844B01D45982E671B239E8BEC@mtxexch01.add0.masergy.com>

"Guy Rouillier" <guyr@masergy.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.



view thread (5+ messages)  latest in thread

Message-ID: <878xwokk4d.fsf@charter.net>
Permalink:  ../878xwokk4d.fsf@charter.net/
Also on:    postgresql.org/message-id/878xwokk4d.fsf@charter.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: quale1@charter.net, pgsql-general@postgresql.org
  Subject: Re: [pgsql-advocacy] Oracle buys Innobase
  In-Reply-To: <878xwokk4d.fsf@charter.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox