Sorry if I'm posting to the wrong list, if so, please could you point me to
the correct list? Thanks!
I'm trying to work with Access and Postgres as backend, but I often get
errors like "unable to find an operator '=' for numeric and float" and
such. Now I've implemented an operator in PLPGSQL, but I'm not very
satisfied with the results (performance-wise). I've tried it in C, but
failed:
I've written a function like this one (I tried to copy the behaviour a
compersion function in utils/adt/numeric.c):
Datum
numeric_float8_eq(PG_FUNCTION_ARGS)
{
Numeric num1 = PG_GETARG_NUMERIC(0);
float8 num2 = PG_GETARG_FLOAT8(1);
bool result;
if (NUMERIC_IS_NAN(num1) || isnan(num2))
result = false;
else
{
float8 num3 = numeric_float8(num1);
if(num2 == num3)
result = true;
else
result = false;
}
PG_FREE_IF_COPY(num1, 0);
PG_RETURN_BOOL(result);
}
Unfortunatly, this fails. The backend dies with a SIGNAL11 when calling
this functions. Are there any examples how to implement such operators (any
example might help)?
Thanks!
Best regards,
Mario Weilguni