Re: Backend dies when overloading + operator for bool

Robert B. Easter <reaster@comptechnews.com>

From: "Robert B. Easter" <reaster@comptechnews.com>
To: Jeff Davis <jdavis@wasabimg.com>, pgsql-bugs@postgresql.org
Date: 2000-12-19T21:08:52Z
Lists: pgsql-bugs
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';