Re: compiled C function for postgresql fails (64-bit only)
--- On Tue, 3/11/09, Frank Miles <fpm@u.washington.edu> wrote:
>
> I have a function that I've used
> since early postgres-7.x days. Now migrating to a
> 64-bit
> (i7) machine - running 2.6.30/'squeeze' with
> postgresql-8.4.1-1. This function is a simple
> one that takes a string representation of a number as its
> sole argument (engineering
> notation), and returns the number. The floating point
> value that it returns is the same
> value {6.94822224692498e-310} with every call, even when
> the string changes.
> The same function works perfectly on a
> separate 2.6.30/'squeeze' system, PG-8.4.1-1,
> that is a 32-bit system - just like it has on previous
> postgres versions.
> If I enable a diagnostic mid-functon
> dump-to-a-file, I can see that the function
> is receiving its input and computing the output properly -
> it's "just" a matter of
> getting the output translated into sql-land. This is
> with the "Version 0" calling
> conventions, with a return type of float8* .
> Attempting "Version 1" calling conventions
> on the 64-bit system has not yet been successful - I
> haven't yet been able to avoid a client
> segfault, whether I use a stack variable for the float8
> result, or use palloc().
From the 8.4 release notes:
"Pass float8, int8, and related datatypes by value inside the server on 64-bit platforms (Zoltan Boszormenyi)
Add configure option --disable-float8-byval to use the old behavior. As above, this change might break old-style external C functions."
So it could be a bug, send it to pgsql-general and you'll get a prompt response.
Reply to: