Re: Backend dies when overloading + operator for bool - Mailing list pgsql-bugs

From Robert B. Easter
Subject Re: Backend dies when overloading + operator for bool
Date
Msg-id 00121916085202.02217@comptechnews
Whole thread Raw
In response to Backend dies when overloading + operator for bool  (Jeff Davis <jdavis@wasabimg.com>)
List 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';

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: pg_dumpall doesn't handle all it should
Next
From: Bill Bunting
Date:
Subject: ResultSet.getTimestamp() Exception