Johann Zuschlag wrote:
> I have the same problem but nobody seems to understand
> that you can't always change the query like in my case,
I understand :-).
My problem occurs for pretty much the same reason, and the suggestion I put
forth on the interfaces.java list is that either the JDBC driver should
understand that an explicit cast is required when substituting the constant
values (much like the way it understands strings and quotes), or that the
back-end should have a commutable =(numeric, float8).
Your routine is not working becase you have no body in your function.
The HACK below does work. I say HACK because
a) this routine should really should be in C
as it will executed billions of times when
used in where clauses (but I am not a "C" programmer)
b) I don't really understand the effects/implications
of the commutator, negator, restrict, and join parameters
(I simply copied them from your example, and the docs
were a bit beyond me)
Maybe someone listening with a bit more pg savvy can help us out further.
P.S. IMHO there should also be "standard" commutable operators for
=(numeric, int8)
=(numeric, int4)
etc...
========================================
Tried on pg7.1, Linux
create function numeric_eq(numeric,float8) returns bool as '
select $1 = $2::numeric;
' language 'sql';
drop operator = (numeric, float8);
create operator = (
leftarg=numeric,
rightarg=float8,
procedure=numeric_eq,
commutator='=',
negator='<>',
restrict=eqsel,
join=eqjoinsel
);
=============================
Mike Finn
Tactical Executive Systems
mike.finn@tacticalExecutive.com