Re: operator is only a shell - Error

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: operator is only a shell - Error
Дата
Msg-id CAKAnmm+K+CHnP3nxd1nSzRnCWcvAw7WqkYna5hmhMYyGxLQk3A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: operator is only a shell - Error  (Rajesh S <rajesh.s@fincuro.com>)
Список pgsql-general
The order of the arguments matter. You need an operator that expects a varchar on the left hand side of the operator, and numeric on the right side. For example:

create database cast_test;
\c cast_test
You are now connected to database "cast_test" as user "greg".

cast_test=# create table deposit_lien(deposit_no varchar);
CREATE TABLE

cast_test=# select * from deposit_lien where deposit_no='0002114029832'::numeric;
ERROR:  operator does not exist: character varying = numeric

cast_test=# create function varchar_eq_numeric(varchar,numeric)
cast_test-# returns bool language sql immutable as $$ select $1::numeric=$2::numeric $$;
CREATE FUNCTION

cast_test=# create operator public.= (function = varchar_eq_numeric,leftarg = varchar,rightarg = numeric);
CREATE OPERATOR

cast_test=# select * from deposit_lien where deposit_no='0002114029832'::numeric;
 deposit_no
------------
(0 rows)

But before creating the function and operator it was working fine

Was it? It helps to show us the exact things ran and the exact output, rather than just "it was working fine" :)

Cheers,
Greg


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

Предыдущее
От: Marc Millas
Дата:
Сообщение: ldap fdw
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: operator is only a shell - Error