Search Postgresql Archives

C-language stored function and float4 type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello! I have C-language stored function like this:

#include <postgres.h>
#include <fmgr.h>

#ifdef PG_MODULE_MAGIC
    PG_MODULE_MAGIC;
#endif

PG_FUNCTION_INFO_V1(testfunc);

Datum testfunc(PG_FUNCTION_ARGS)
{
    float4 x = PG_GETARG_FLOAT4(0);
    float4 y = PG_GETARG_FLOAT4(1);

    PG_RETURN_FLOAT4(x + y);
}

CREATE FUNCTION testfunc ( x real, y real )
RETURNS real AS
'testfunc'
LANGUAGE C STRICT;

If i use this function (SELECT testfunc ( 0.1, 0.2 )) I get result with type "double precision". I tried used float4 but the result was the same. What is wrong?


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux