Re: Compare with CHAR - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Compare with CHAR
Date
Msg-id web-682319@davinci.ethosmedia.com
Whole thread Raw
In response to Compare with CHAR  ("Tomas Eriksson" <tomas_@spray.se>)
List 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 thespace-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 somequeries?

-Josh

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


pgsql-sql by date:

Previous
From: "John"
Date:
Subject: export/save meta data
Next
From: Andre Holzner
Date:
Subject: plpgsql function with more than one array argument