string cast/compare broken? - Mailing list pgsql-hackers

From Scott Royston
Subject string cast/compare broken?
Date
Msg-id D217A228-9517-11D6-BBE3-000393577144@mac.com
Whole thread Raw
Responses Re: string cast/compare broken?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Mac OS X:
postgres% psql --version
psql (PostgreSQL) 7.2.1
contains support for: multibyte

LEDEV=# create table test1 (foo varchar(5));
CREATE
LEDEV=# create table test2 (foo char(5));
CREATE
LEDEV=# insert into test2 (foo) values ('S');
INSERT 3724249 1
LEDEV=# insert into test1 (foo) values ('S');
INSERT 3724250 1
LEDEV=# select a.foo, b.foo from test1 a, test2 b where a.foo = 
b.foo::text; foo | foo
-----+-----
(0 rows)

LEDEV=# select a.foo = 'S', b.foo = 'S' from test1 a, test2 b; ?column? | ?column?
----------+---------- t        | t
(1 row)

LEDEV=# select a.foo, b.foo from test1 a, test2 b where CAST(a.foo as 
CHAR) = b.foo; foo |  foo
-----+------- S   | S
(1 row)



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: please help on query
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Changes in /contrib/fulltextindex