Re: How do I... - Mailing list pgsql-general

From Paul Tomblin
Subject Re: How do I...
Date
Msg-id 20010401181604.A5224@allhats.xcski.com
Whole thread Raw
In response to Re: another index question  ("ADBAAMD" <adba.amdocs@bell.ca>)
Responses Re: How do I...
Re: How do I...
List 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@xcski.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

pgsql-general by date:

Previous
From: "Denis A. Doroshenko"
Date:
Subject: Re: Ok, why isn't it using *this* index?
Next
From: "ADBAAMD"
Date:
Subject: Re: Ok, why isn't it using *this* index?