Re: How do I...

From: Paul Tomblin <ptomblin(at)xcski(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How do I...
Date: 2001-04-01 22:16:04
Message-ID: 20010401181604.A5224@allhats.xcski.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How do I compare a char (bpchar?) to a varchar? I tried using "=", and I
got:

waypoint=> select b.id, a.icao,a.faa_host_id from dafif_arpt a, waypoint b
where b.id = a.icao;
ERROR: Unable to identify an operator '=' for types 'varchar' and 'bpchar'
You will have to retype this query using an explicit cast

Why isn't this working? Can somebody explain how to rephrase this? It
doesn't work even if I try to cast the varchar to bpchar:

waypoint=> select b.id, a.icao,a.faa_host_id from dafif_arpt a, waypoint b
where b.id::char = a.icao;
ERROR: Unable to identify an operator '=' for types 'varchar' and 'bpchar'
You will have to retype this query using an explicit cast

Or the bpchar to varchar:

waypoint=> select b.id, a.icao,a.faa_host_id from dafif_arpt a, waypoint b
where b.id = a.icao::varchar;
ERROR: Unable to identify an operator '=' for types 'varchar' and 'bpchar'
You will have to retype this query using an explicit cast

Oh, and if I try and cast them both to varchar, the thing freaks out:

waypoint=> select b.id, a.icao,a.faa_host_id from dafif_arpt a, waypoint b
where b.id::varchar = a.icao::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.

--
Paul Tomblin <ptomblin(at)xcski(dot)com>, not speaking for anybody
"I know not with what weapons World War III will be fought, but World
War IV will be fought with sticks and stones."
-- Albert Einstein

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message ADBAAMD 2001-04-01 22:19:26 Re: Ok, why isn't it using *this* index?
Previous Message Denis A. Doroshenko 2001-04-01 22:13:46 Re: Ok, why isn't it using *this* index?