Project

General

Profile

« Previous | Next » 

Revision 14176

bugfix: schemas/util.sql: functions that access the DB must be STABLE rather than IMMUTABLE

View differences:

trunk/schemas/util.sql
891 891
--
892 892

  
893 893
CREATE FUNCTION check_constraint_defs(table_ regclass) RETURNS SETOF check_constraint_def
894
    LANGUAGE sql IMMUTABLE
894
    LANGUAGE sql STABLE
895 895
    AS $_$
896 896
SELECT constraint_ FROM util.check_constraint WHERE table_ = $1
897 897
$_$;
......
1580 1580
--
1581 1581

  
1582 1582
CREATE FUNCTION derived_col_def(check_constraint_def check_constraint_def) RETURNS derived_col_def
1583
    LANGUAGE sql IMMUTABLE
1583
    LANGUAGE sql STABLE
1584 1584
    AS $$
1585 1585
SELECT (
1586 1586
  check_constraint_def.constraint_::util.col
......
1594 1594
--
1595 1595

  
1596 1596
CREATE FUNCTION derived_col_def(col col) RETURNS derived_col_def
1597
    LANGUAGE sql IMMUTABLE
1597
    LANGUAGE sql STABLE
1598 1598
    AS $$
1599 1599
SELECT util.check_constraint_def(col)::util.derived_col_def
1600 1600
$$;
......
1605 1605
--
1606 1606

  
1607 1607
CREATE FUNCTION derived_col_defs(table_ regclass) RETURNS SETOF derived_col_def
1608
    LANGUAGE sql IMMUTABLE
1608
    LANGUAGE sql STABLE
1609 1609
    AS $$
1610 1610
/* **IMPORTANT**: derived columns *must* be returned in table order (which
1611 1611
should = dependency order), so that they are populated in dependency order */

Also available in: Unified diff