Project

General

Profile

« Previous | Next » 

Revision 14175

bugfix: schemas/util.sql: derived_col_defs(): derived columns must be returned in table order (which should = dependency order), so that they are populated in dependency order

View differences:

trunk/schemas/util.sql
1606 1606

  
1607 1607
CREATE FUNCTION derived_col_defs(table_ regclass) RETURNS SETOF derived_col_def
1608 1608
    LANGUAGE sql IMMUTABLE
1609
    AS $_$
1610
SELECT constraint_::util.derived_col_def
1611
FROM util.check_constraint
1612
WHERE table_ = $1 AND name IN (SELECT * FROM util.col_names($1))
1613
$_$;
1609
    AS $$
1610
/* **IMPORTANT**: derived columns *must* be returned in table order (which
1611
should = dependency order), so that they are populated in dependency order */
1612
SELECT * FROM
1613
(SELECT col::util.derived_col_def def FROM util.cols(table_) col) s
1614
WHERE def IS NOT NULL/*is a derived col*/
1615
$$;
1614 1616

  
1615 1617

  
1616 1618
--

Also available in: Unified diff