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



---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to