Re: Error: Operator does not exist: "char"=integer

From: Aarni <aarni(at)kymi(dot)com>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error: Operator does not exist: "char"=integer
Date: 2008-12-19 09:47:39
Message-ID: 200812191147.39589.aarni@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 19 December 2008 01:29:06 you wrote:
> Aarni <aarni(at)kymi(dot)com> writes:
> > "ERROR: operator does not exist: character varying = integer at
> > character 286 HINT: No operator matches the given name and argument
> > type(s). You might need to add explicit type casts."
> >
> > Quick fix to sql statements eg.
> >
> > ... WHERE CAST (your_char AS INTEGER) = integer ...
> > ... WHERE CAST (your_char AS INTEGER) IN (1,2,3,...)
>
> Note that this is *not* what was happening in 8.2. There it was casting
> them to text and doing a text comparison. In the case of integer and
> equality they're probably equivalent. However < and > will behave quite
> differently. That's why the casts disappeared -- you probably weren't
> running the queries you thought you were running in 8.2 and previously.

Hi Gregory,

Hmm, yes I did note this. Afterwards, though.

"Previously ... was automatically cast to text, for most (though not all)
built-in data type ... automatic casts too often caused surprising behavior."

Luckily enough, I did not get funny or unexpected results with the few queries
in one particular application I had to fix for 8.3.3.

Best regards,

--
Aarni Ruuhimäki

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2008-12-19 09:58:57 Re: Hi iam the beginner
Previous Message Thomas Kellerer 2008-12-19 08:32:51 How are locks managed in PG?