using a function in where

Поиск
Список
Период
Сортировка
От Glenn Schultz
Тема using a function in where
Дата
Msg-id CAE-4=KG7ZYpTntiLZfL8AN+3oE2OmxDRDUaoWpeGz+cFxBy9mA@mail.gmail.com
обсуждение исходный текст
Ответы Re: using a function in where
Re: using a function in where
Список pgsql-general
All,
I am using the function below to convert a continuous variable to a binned value.  Sometimes a value other than zero is passed through the query. For example -.5 result value is passed to the query result.  The basic of the query is below.  

select
incentivebin(wac, rate, .25)
from
my_table
where incentivebin(was, rate, .25) = 0

I have checked the function works correctly and the raw values match those values expected from simple subtraction and are in the correct bin.  I am not sure why some values would be allowed through the query. Any ideas would be appreciated.

Best,
Glenn


CREATE or REPLACE FUNCTION embs_owner.IncentiveBin(IN "Gwac" double precision, 
  IN "MtgRate" double precision, 
  IN "BinSize" double precision)
    RETURNS double precision
    LANGUAGE 'sql'
    PARALLEL SAFE
AS 'select ceiling(($1 - $2)/$3) *$3';

ALTER FUNCTION embs_owner.IncentiveBin(double precision, double precision, double precision)
    OWNER TO embs_owner;

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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: psql is hanging
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: using a function in where