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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 38.10.6. Composite-Type Arguments C-language function code demo works for int, but not for numeric.
Дата
Msg-id 1369043.1675263944@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 38.10.6. Composite-Type Arguments C-language function code demo works for int, but not for numeric.  (jian he <jian.universality@gmail.com>)
Список pgsql-general
jian he <jian.universality@gmail.com> 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Mateusz Henicz
Дата:
Сообщение: Re: pg_rewind and replication user
Следующее
От: Wim Bertels
Дата:
Сообщение: Re: Best Open Source OS for Postgresql