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