Skip site navigation (1) Skip section navigation (2)

Re: Unable to identify a right operator '>=' for type 'bpchar'

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Ma <mikema(at)ficnet(dot)net>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Unable to identify a right operator '>=' for type 'bpchar'
Date: 2000-05-24 16:33:37
Message-ID: 7602.959186017@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-sql
Michael Ma <mikema(at)ficnet(dot)net> writes:
> While running the following SQL statement in postgresql-7.0-1 via
> JDBC,

>    select a.cus_code, a.dlv_code, b.cus_abbr, a.dlv_abbr,
>           a.address, a.tel, a.fax, a.contact
>      from dlv_point a, customer b
>     where ((a.cus_code >= ? and a.cus_code <= ?)
>           or (b.cus_abbr >= ? and b.cus_abbr <= ?))
>       and trim(b.cus_code) = trim(a.cus_code)
>     order by 1 ;

> I got the following error message:

>    Unable to identify a right operator '>=' for type 'bpchar'
>    You may meed to add parentheses or an explicit cast.

It looks to me like the parser is thinking that "a.cus_code >= ?"
must represent application of a suffix operator '>=' followed by
application of another suffix operator '?'.  Which is indeed about
the only way it could make any sense of the expression.

I assume you were expecting something to get substituted for the '?'
marks before the query is submitted, but it evidently didn't happen ...

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Thomas HolmgrenDate: 2000-05-24 17:08:50
Subject: Why is PostgreSQL 7.0 SQL semantics different from Oracle's?
Previous:From: gomathi rajuDate: 2000-05-24 15:37:27
Subject:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group