char/varchar conversions

From: Peter Haworth <pmh(at)edison(dot)ioppublishing(dot)com>
To: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: char/varchar conversions
Date: 2000-11-15 13:13:04
Message-ID: 200011151312.eAFDCks03783@mail.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)edison(dot)ioppublishing(dot)com
Anything that can go wrong, will go wr

Responses

Browse pgsql-general by date

  From Date Subject
Next Message mlw 2000-11-15 14:05:19 Re: [HACKERS] Re: PHPBuilder article -- Postgres vs MySQL
Previous Message Martin A. Marques 2000-11-15 12:14:18 Re: PHPBuilder article -- Postgres vs MySQL