Crash on userdefined operator - Mailing list pgsql-hackers

From Mario Weilguni
Subject Crash on userdefined operator
Date
Msg-id 00090520344704.00493@loki
Whole thread Raw
Responses Re: Crash on userdefined operator
List 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
usingan 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-----


pgsql-hackers by date:

Previous
From: Kristofer Munn
Date:
Subject: Indexes on Arrays
Next
From: Larry Rosenman
Date:
Subject: 7.0.2: Arrays