Jeff Davis writes:
> I made some simple functions that create the operators + and - for any
> combination of int4's and bool's.
>
> The reasoning that propted this operator was that I wanted to use the
> following syntax in a query:
> SELECT *,((col_a == 'foo') + (col_b == 'bar')) as relevance WHERE
> relevance > 0;
You could also try
case when col_a = 'foo' then 1 else 0 end + case when col_b = 'bar' then 1
else 0 end
which is the usual way to "cast" booleans.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter