From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
---|---|
To: | "zhuge xiao" <zhuge(at)Rinaix(dot)cn> |
Cc: | <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Memory Allocation Error |
Date: | 2007-09-24 12:00:06 |
Message-ID: | 87ir60ff3t.fsf@oxford.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
"zhuge xiao" <zhuge(at)Rinaix(dot)cn> writes:
> I wrote and compiled and linked a C function, add_float, which returns
> float in C like following:
>
> PG_FUNCTION_INFO_V1(add_float);
>
> Datum
> add_float(PG_FUNCTION_ARGS)
> {
> float arg = PG_GETARG_FLOAT8(0);
>
> PG_RETURN_FLOAT8(arg + 10);
> }
>
> After having loaded it into database, executed the SQL command, "select
> ad_float(2.90)", but one error occured. The error message is "Error:
> invalid memory alloc request size 4294967290" .
float8 and float aren't the same thing. "float" is a C data type which is not
wide enough to hold a float8. The first line actually works by shortening it
but the return doesn't work because it returns a pointer to the float and
claims it's a pointer to the float8.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2007-09-24 13:06:31 | Re: BUG #3616: PgAdminIII crashes on copy operation |
Previous Message | Heikki Linnakangas | 2007-09-24 09:23:20 | Re: BUG #3628: Wrong schema picked |