Search Postgresql Archives

Re: 38.10.6. Composite-Type Arguments C-language function code demo works for int, but not for numeric.

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

 



jian he <jian.universality@xxxxxxxxx> writes:
> column "salary" int data type works fine. But it does not work if the
> "salary" column data type is numeric.

Your problem is that numeric is not a primitive C type:

>     PG_RETURN_BOOL(DatumGetNumericCopy(salary) > limit);

That is comparing two pointers-to-numerics, not the values of
the numerics.  You'd need to invoke numeric_cmp() if you
want a sensible result.

			regards, tom lane





[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 Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux