Re: Compare with CHAR

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: "Tomas Eriksson" <tomas_(at)spray(dot)se>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Compare with CHAR
Date: 2002-02-01 19:41:47
Message-ID: web-682319@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tomas,

> I'm using a table with a indexed CHAR(3)-column. When I use SELECT ..
> WHERE
> Col = 'XXX', some results are empty, but the value in the row seems
> to be
> correct like other rows. If I update the row with same data I can get
> it
> into the result. So I didn't find any logic reason for this. I can
> find all
> rows using LIKE (or with some substring tests) with no problems.
> Shouldn't =
> always works the same..? (Postgres 7.1.3)

I'm pretty sure that your problem has something to do with the
space-padding of CHAR columns. Please remember that
'JB'::CHAR(5) = 'JB ' != 'JB'::VARCHAR(5)

If you're sure that's not it, how about posting a tabledef and some
queries?

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Diehl, Jeffrey 2002-02-01 20:25:35 NOTICE: Vacuum: can not process indices, views and certain system tables
Previous Message Kevin Barrett 2002-02-01 17:57:03 syntax for using function parameter in to_char