Re: Implementing an operator in C?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mario Weilguni <mweilguni(at)sime(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Implementing an operator in C?
Date: 2001-02-04 19:12:06
Message-ID: 6744.981313926@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mario Weilguni <mweilguni(at)sime(dot)com> writes:
> float8 num3 = numeric_float8(num1);

That won't work in the brave new world of 7.1 :-(. You need to do
something like

float8 num3 = DatumGetFloat8(DirectFunctionCall1(numeric_float8,
NumericGetDatum(num1)));

Ugly, I know ... but we have to be rigidly careful about converting
values to Datum and back in order to avoid portability problems.

A decent C compiler should've warned about type mismatches in your call,
BTW.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-02-04 19:26:16 Re: Re: [PATCHES] A Sparc/Linux patch (for 7.1), and a Linux rc.d/init.d script....
Previous Message Tom Lane 2001-02-04 18:59:12 Re: Like vs '=' bug with indexing