Crash on userdefined operator

From: Mario Weilguni <mweilguni(at)sime(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Crash on userdefined operator
Date: 2000-09-05 18:34:47
Message-ID: 00090520344704.00493@loki
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-----BEGIN PGP SIGNED MESSAGE-----

Sorry to bother you with this question, but I've found a bug with operators:
Example:

create table dummy ( a numeric(12,0), b float8);
insert into dummy (a,b) values (1, 2);
insert into dummy (a,b) values (7, 7);
insert into dummy (a,b) values (3, 2);
insert into dummy (a,b) values (4, 2);

Now try:
select * from dummy where a=b;
ERROR: Unable to identify an operator '=' for types 'numeric' and 'float8'
You will have to retype this query using an explicit cast

So I tried to define an operator:
create function num_eq_float (numeric, float8) returns bool as
'select $1::float8 = $2::float8' language 'sql';

select * from dummy where num_eq_float(a,b)=true;
a | b
- ---+---
7 | 7
(1 row)

Works fine so far. Now I tried:
create operator = (
leftarg = numeric,
rightarg=float8,
procedure = num_eq_float
);
CREATE

And now I tried:
select * from dummy where a=b;
pqReadData() -- backend closed the channel unexpectedly.
This probably means the backend terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Obviously the backend process crashed, but I have no clue what I might be
doing wrong.

Regards,
Mario Weilguni

- --
Why is it always Segmentation's fault?
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBObU8xwotfkegMgnVAQGuqAP/TFk6HYqVmKdmv5WqRiIlChYQbGNWnEDv
BYG183EXfeYoPkCZXU2ZJVbYUZObHVssxrFNEmoXgOdVJ1BLaVoVwIA3UFjAkZ4f
mPaS7kSSWYDf1EvGPMCiFc9TYdLDI0M1GsBUKNjeLEqwlAdXWiVEjrSLBgnMZXa+
+e+3vMSv4Fc=
=ok3E
-----END PGP SIGNATURE-----

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeljko Trogrlic 2000-09-05 19:00:46 Re: Report of performance on Alpha vs. Intel
Previous Message Steve Wolfe 2000-09-05 17:42:09 Re: Report of performance on Alpha vs. Intel