char/varchar conversions - Mailing list pgsql-general

From Peter Haworth
Subject char/varchar conversions
Date
Msg-id 200011151312.eAFDCks03783@mail.postgresql.org
Whole thread Raw
Responses Re: char/varchar conversions
List pgsql-general
I'm having trouble getting Postgres 6.5.3 to do what I want. The problem seems
to be fixed in version 7, but I could really do with a workaround for 6.5.3,
since I'm stuck with that for the time being.

journals2=> create table vc(v varchar(9), c char(9));
CREATE
journals2=> insert into vc values('abc','abc');
INSERT 1631143 1
journals2=> select * from vc where v::char(9)=c;
ERROR:    Unable to identify an operator '=' for types 'varchar' and 'bpchar'
    You will have to retype this query using an explicit cast

Surely I did use an explicit cast? The same thing happens whether I cast one
side or the other or both. Let's try being sneakier:

journals2=> select * from vc where v::text::varchar=c::text::varchar;
pqReadData() -- backend closed the channel unexpectedly.
    This probably means the backend terminated abnormally
    before or while processing the request.
We have lost the connection to the backend, so further processing is
impossible.  Terminating.

That's obviously too sneaky.

--
    Peter Haworth    pmh@edison.ioppublishing.com
Anything that can go wrong, will go wr



pgsql-general by date:

Previous
From: "Martin A. Marques"
Date:
Subject: Re: PHPBuilder article -- Postgres vs MySQL
Next
From: "carl garland"
Date:
Subject: Re: [HACKERS] Re: PHPBuilder article -- Postgres vs MySQL