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: Thu, 18 Jun 2009 00:40:11 +0530
- Message-id: <14af40510906171210x3452fdbay4f77345b41751e20@mail.gmail.com> <text/plain>
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
>
Home |
Main Index |
Thread Index