Char = varchar

From: "Glen Parker" <glenebob(at)nwlink(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Char = varchar
Date: 2002-06-04 22:25:16
Message-ID: 013c01c20c16$b3ccc330$0b01a8c0@johnpark.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Didn't see a reference to this in the archives, so here goes.
In pg 7.2.1, comparing char to varchar appears broken. Can't believe
there isnt more chatter about this on the list. Anyhow, try the
following:

Create table test (field1 char(10), field2 varchar(10));
Select count(*) from test where field1 = field2;

You get:

ERROR: Unable to identify an operator '=' for types 'character' and
'character varying'
You will have to retype this query using an explicit cast

Not sure what I'm asking for here... I know casting will fix it, I know
changing my schema will work. Would creating an operator be a
reasonable workaround perhaps?

Tia
Glen Parker
glenebob(at)nwlink(dot)com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-06-04 23:03:00 Re: ctid & updates
Previous Message Zhou, Lixin 2002-06-04 20:21:36 a trigger question