Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer

From: Ashish Jain <ashjain2(at)gmail(dot)com>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
Date: 2009-06-17 19:10:11
Message-ID: 14af40510906171210x3452fdbay4f77345b41751e20@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi Richard,

I have created a function and a cast in the following way. It helps me to
subside the error but I still do not get the desired result. So I am not
sure if this only helps to subside the error message.

create function integer2character(in integer) returns character as 'select

$1::character' language sql immutable returns null on null input;

create cast (integer AS character) with function integer2character (in
integer) AS

implicit;

Thanks
Ashish

On Wed, Jun 17, 2009 at 8:26 PM, Richard Broersma <
richard(dot)broersma(at)gmail(dot)com> wrote:

> On Wed, Jun 17, 2009 at 6:35 AM, Ashish Jain<ashjain2(at)gmail(dot)com> wrote:
>
> > Can any one help me to write a cast statement which automatically cast
> > integer to character??
>
> The SQL standard way would be: CAST( your_int_column AS TEXT )
> or the Postgresql way: your_int_column::TEXT
>
>
> --
> Regards,
> Richard Broersma Jr.
>
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Ivan Bojer 2009-06-17 19:57:54 Please help! - Constraints Exception
Previous Message Richard Broersma 2009-06-17 14:56:53 Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer