--- database.pgsql.orig Mon Oct 24 13:06:58 2005 +++ database.pgsql Mon Oct 24 13:15:54 2005 @@ -822,6 +822,19 @@ --- Functions --- +CREATE FUNCTION IF(bool, anyelement, anyelement) RETURNS anyelement AS ' +BEGIN + IF $1 THEN + RETURN $2; + END IF; + RETURN $3; +END; +' LANGUAGE 'plpgsql'; + +CREATE FUNCTION IF(integer, anyelement, anyelement) RETURNS anyelement AS ' + SELECT IF($1 = 0, $2, $3); +' LANGUAGE 'sql'; + CREATE FUNCTION greatest(integer, integer) RETURNS integer AS ' BEGIN IF $2 IS NULL THEN