Обсуждение: question re org.postgresql.util.PSQLException

Поиск
Список
Период
Сортировка

question re org.postgresql.util.PSQLException

От
Дата:

The following query works in pgAdmin query tool but not when run within a java pgm.  Don’t see any postings with inet as the culprit type for the error.  And yes  the OR subclause is redundant. Didn’t catch it till reviewing the error.

 

Anyone see anything like this and what the cause is?  I have the same statement (no OR clause) working with C# and both the postgres and default ODBC drivers.  Not sure which driver my colleague was using but presume Postgres from the error msg. Changed values to protect the guilty. J  Java related?

 

SELECT f1, f2, f3, f4 FROM schema.tbl WHERE 'x.x.x.x' between low_address AND high_address AND fld10 = 0 OR 'x.x.x.x' between low_address AND high_address AND fld10 count = 0

 

org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying >= inet

  Hint: No operator matches the given name and argument type(s). You may need to add explicit type casts.

  Position: 163

 

The actual character at position 163 was the first dot after the first address’s digit, ie., x. after the WHERE.

 

Thanks in advance.

 

Re: question re org.postgresql.util.PSQLException

От
Dave Cramer
Дата:
Why is this on the ODBC list ?

Yes, you would need to cast the 'x.x.x.x' to an inet address first

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca


On Wed, Jul 18, 2012 at 11:29 AM,  <william.ford@emc.com> wrote:
> The following query works in pgAdmin query tool but not when run within a
> java pgm.  Don’t see any postings with inet as the culprit type for the
> error.  And yes  the OR subclause is redundant. Didn’t catch it till
> reviewing the error.
>
>
>
> Anyone see anything like this and what the cause is?  I have the same
> statement (no OR clause) working with C# and both the postgres and default
> ODBC drivers.  Not sure which driver my colleague was using but presume
> Postgres from the error msg. Changed values to protect the guilty. J  Java
> related?
>
>
>
> SELECT f1, f2, f3, f4 FROM schema.tbl WHERE 'x.x.x.x' between low_address
> AND high_address AND fld10 = 0 OR 'x.x.x.x' between low_address AND
> high_address AND fld10 count = 0
>
>
>
> org.postgresql.util.PSQLException: ERROR: operator does not exist: character
> varying >= inet
>
>   Hint: No operator matches the given name and argument type(s). You may
> need to add explicit type casts.
>
>   Position: 163
>
>
>
> The actual character at position 163 was the first dot after the first
> address’s digit, ie., x. after the WHERE.
>
>
>
> Thanks in advance.
>
>