Search Postgresql Archives

Re: Can we overload = operator to word numeric = text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Dear Pavel,

Thanks a lot...

It worked.

Regards,
Venkat


From: Pavel Stehule <pavel.stehule@xxxxxxxxx>
To: venkatrao.b@xxxxxxx
Cc: pgsql-novice@xxxxxxxxxxxxxx, pgsql-general@xxxxxxxxxxxxxx
Date: 03/09/2010 04:07 PM
Subject: Re: Can we overload = operator to word numeric = text





2010/3/9  <venkatrao.b@xxxxxxx>:
>
> Hello,
>
> We have migrated oracle  database to postgre.
> In oracle char to numeric type conversion is explicit (i.e. we can compare
> char = numeric); but in postgre it is throwing errors. There are so many
> functions - around 2000, and we can not go and do explict type casting in
> every function , where there is problem.
>
> Is there any way to come out of this problem. I mean is there any way to
> make = operator work for numeric = charater varying .
> Your suggestions are highly appreciated.

try

create or replace function num_text_eq(numeric, varchar)
returns bool as $$
 select $1 = $2::numeric$$
language sql;

create operator = ( leftarg=numeric,  rightarg=varchar, procedure=num_text_eq);
postgres=# select 10='10';
?column?
----------
t
(1 row)

regards
Pavel Stehule




>
> Venkat
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>


=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux