Project

General

Profile

« Previous | Next » 

Revision 12218

schemas/util.sql: added ifnull(), equivalent to MySQL's IFNULL (Postgres auto-lowercases the name)

View differences:

trunk/schemas/util.sql
1374 1374

  
1375 1375

  
1376 1376
--
1377
-- Name: ifnull(anyelement, anyelement); Type: FUNCTION; Schema: util; Owner: -
1378
--
1379

  
1380
CREATE FUNCTION ifnull(value anyelement, null_ anyelement) RETURNS anyelement
1381
    LANGUAGE sql IMMUTABLE
1382
    AS $_$
1383
SELECT (CASE WHEN $1 IS NULL THEN $2 ELSE $1 END)
1384
$_$;
1385

  
1386

  
1387
--
1388
-- Name: FUNCTION ifnull(value anyelement, null_ anyelement); Type: COMMENT; Schema: util; Owner: -
1389
--
1390

  
1391
COMMENT ON FUNCTION ifnull(value anyelement, null_ anyelement) IS 'equivalent to MySQL''s IFNULL() (Postgres auto-lowercases the name)';
1392

  
1393

  
1394
--
1377 1395
-- Name: is_constant(col_ref); Type: FUNCTION; Schema: util; Owner: -
1378 1396
--
1379 1397

  

Also available in: Unified diff