Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 8BE47634DDB for ; Wed, 17 Jun 2009 16:10:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 33332-02-8 for ; Wed, 17 Jun 2009 16:10:12 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by mail.postgresql.org (Postfix) with ESMTP id 6DF836349F3 for ; Wed, 17 Jun 2009 16:10:13 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 8so272212qwh.61 for ; Wed, 17 Jun 2009 12:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=RvFSK6ZWNE3WbvudWEAmuDibZfJDCA3rS/s3roEOono=; b=dNQsAT/V7nYpn9jErAc9oy2p3H9JN063mrHiHDLE9hxADCznhrFYuwfPYAS2amHcRK 21JHEGV+FBlLCgACZpkZOUE9VPHPhacy91RQN1IvjFAikk59qG2laB7uF81mlXi3oJnP ARa5k+9FMEUu/Pc5HpdBIEglszEvbXJTIe3q0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=YSbO40JwazzzqD2YeJSKkSdPgmci1tnf1P635bPVtjbpqkNnKPzNuaQaIvJBEYYf7A BmyuNKNk6xXjjXguCjz9Pf1RSr0ZaPCTuld7VSjSHn5uYXvcKupjOZGuKCTPa4a+bkTv Z/8c9AmVdDCoIxL3Il6sc4d048BAhmBQ+xALY= MIME-Version: 1.0 Received: by 10.220.46.85 with SMTP id i21mr758593vcf.19.1245265811830; Wed, 17 Jun 2009 12:10:11 -0700 (PDT) In-Reply-To: <396486430906170756n3c8698fbm3951c0029dc673f1@mail.gmail.com> References: <14af40510906170635w7c793ef0p3f36b13fc9958cdb@mail.gmail.com> <396486430906170756n3c8698fbm3951c0029dc673f1@mail.gmail.com> Date: Thu, 18 Jun 2009 00:40:11 +0530 Message-ID: <14af40510906171210x3452fdbay4f77345b41751e20@mail.gmail.com> Subject: Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer From: Ashish Jain To: Richard Broersma Cc: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=0016363b839a5d7d19046c900a6a X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200906/66 X-Sequence-Number: 19730 --0016363b839a5d7d19046c900a6a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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.broersma@gmail.com> wrote: > On Wed, Jun 17, 2009 at 6:35 AM, Ashish Jain 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 > --0016363b839a5d7d19046c900a6a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Richard,

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

create function integer2character(in integer) return= s character as 'select

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

=A0

=A0

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

implicit;

=A0

Thanks
Ashish


On Wed, Jun 17, 2009= at 8:26 PM, Richard Broersma <richard.broersma@gmail.com> wrote:
=
On Wed, Jun 17, 2009 at 6:35 AM, Ashish Jain<ashjain2@gmail.com> wrote:

> Can any one help me to write a cast statement which automatically cast=
> integer to character??

The SQL standard way would be: =A0CAST( your_int_column AS TEXT )
or the Postgresql way: =A0your_int_column::TEXT


--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.= postgresql.org/lapug

--0016363b839a5d7d19046c900a6a--