Is it possible to extend the COALESCE() function? I would like
to support for coalescing an int into a Boolean, but I get syntax errors if I
don’t wrap coalesce in quotes. CREATE OR REPLACE FUNCTION coalesce(boolean,int) RETURNS
boolean AS $$ SELECT CASE WHEN $1 IS NOT NULL THEN $1 WHEN
$2 = 1 THEN true ELSE false END $$ LANGUAGE sql IMMUTABLE; Thanks, Dave |