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

Поиск
Список
Период
Сортировка
От Ashish Jain
Тема Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
Дата
Msg-id 14af40510906171210x3452fdbay4f77345b41751e20@mail.gmail.com
обсуждение исходный текст
Ответ на Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer  (Richard Broersma <richard.broersma@gmail.com>)
Список 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.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:  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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Richard Broersma
Дата:
Сообщение: Re: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer
Следующее
От: Ivan Bojer
Дата:
Сообщение: Please help! - Constraints Exception