boolean function return values
От | Eugene Barlow |
---|---|
Тема | boolean function return values |
Дата | |
Msg-id | 1092246088.28529.8.camel@legolas обсуждение исходный текст |
Ответы |
Re: boolean function return values
|
Список | pgsql-general |
Can someone explain why I would get different results when using "WHERE x()" v.s. using "WHERE x() = true" for functions that return a boolean? We have also seen the query optimizer behave differently between the two uses when using functional indices. I am using postgres 7.4.2 and here are the real details: CREATE OR REPLACE FUNCTION validlivesitecontent(text, text, integer) RETURNS boolean AS ' DECLARE Publisher ALIAS for $1; ContentType ALIAS for $2; Status ALIAS for $3; BEGIN return (Status & 3 = 0) and (Publisher != ''DataSource'' and ContentType != ''Packages'' and ContentType != ''SpecialDeals''); END; ' LANGUAGE plpgsql IMMUTABLE STRICT; user1=# select count(*) from t_content where validlivesitecontent(publisher, contenttype, status); count -------- 770403 (1 row) user1=# select count(*) from t_content where validlivesitecontent(publisher, contenttype, status) = true; count --------- 1258365 (1 row) Thanks! --Eugene Barlow TripAdvisor - www.tripadvisor.com
В списке pgsql-general по дате отправления: