From: | "Mitch Vincent" <mvincent(at)cablespeed(dot)com> |
---|---|
To: | "Johann Zuschlag" <zuschlag(at)online(dot)de>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Overwriting Operator for numeric and float8 fails |
Date: | 2001-08-20 15:55:40 |
Message-ID: | 004601c12990$907969b0$1251000a@mitch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Just cast 00000034.70 to numeric...
SELECT t6.* FROM RECHNUNG t6 WHERE t6.bruttosumm = 00000034.70::numeric
ORDER BY t6.nummer DESC
Note that if that column is numeric, it's going to knock off any leading
zeros..
> Hi,
>
> I've got a really stupid question. My application does queries like this:
>
> SELECT t6.* FROM RECHNUNG t6 WHERE t6.bruttosumm = 00000034.70 ORDER BY
t6.nummer DESC
>
> I get the following error: Unable to identify an operator '=' for types
'numeric' and 'float8'...
> and of course the same for the operator '<>'. Ok, quotes missing.
>
> Before I just let the ODBC-driver patch the quotes. Not so smart.
> Now I tried the smarter way by overwriting the operator:
>
> create function numeric_eq(numeric,float8)
> returns bool
> as ''
> language 'internal';
>
> create operator = (
> leftarg=numeric,
> rightarg=float8,
> procedure=numeric_eq,
> commutator='=',
> negator='<>',
> restrict=eqsel,
> join=eqjoinsel
> );
>
> The Problem is: It doesn't work and the backend process crashes and get's
restarted.
> I tried it with 7.03 and I guess 7.1.2 behaves the same.
> What am I doing wrong? Can somebody give me a hint?
>
> Thanks in advance
>
>
>
> Johann Zuschlag
> zuschlag(at)online(dot)de
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Mitch Vincent | 2001-08-20 16:06:16 | Re: COUNT(*) very slow on table with primary key |
Previous Message | Stephan Szabo | 2001-08-20 15:45:23 | Re: Real newbie question. |