On Tuesday 19 December 2000 22:11, Jeff Davis wrote:
>
> create function bool_to_int(bool) returns int as 'select 1 as result
> where $1 union select 0 as result where not $1;' language 'sql';
This is an alternative way to make the bool_to_int, but it doesn't solve your
problem unless the union was causing a bug:
CREATE FUNCTION bool_to_int(BOOLEAN) RETURNS INTEGER AS '
SELECT CASE WHEN $1 THEN 1 ELSE 0 END AS result;
' LANGUAGE 'SQL';