Revision 14193
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
1728 | 1728 |
CREATE FUNCTION derived_cols_populate(table_ regclass) RETURNS void |
1729 | 1729 |
LANGUAGE sql |
1730 | 1730 |
AS $$ |
1731 |
SELECT CASE WHEN NOT util.derived_cols_populated(table_) |
|
1732 |
THEN |
|
1733 |
(SELECT NULL::void FROM (SELECT |
|
1731 | 1734 |
-- populate derived columns by triggering table__fill_derived() |
1732 |
SELECT util.run_triggers(table_); |
|
1733 |
|
|
1734 |
SELECT util.derived_col_constraints_enable(table_); |
|
1735 |
util.run_triggers(table_) |
|
1736 |
, |
|
1737 |
util.derived_col_constraints_enable(table_) |
|
1738 |
) s) |
|
1739 |
END |
|
1735 | 1740 |
$$; |
1736 | 1741 |
|
1737 | 1742 |
|
1738 | 1743 |
-- |
1744 |
-- Name: FUNCTION derived_cols_populate(table_ regclass); Type: COMMENT; Schema: util; Owner: - |
|
1745 |
-- |
|
1746 |
|
|
1747 |
COMMENT ON FUNCTION derived_cols_populate(table_ regclass) IS ' |
|
1748 |
idempotent, and only runs if needed |
|
1749 |
'; |
|
1750 |
|
|
1751 |
|
|
1752 |
-- |
|
1739 | 1753 |
-- Name: derived_cols_populated(regclass); Type: FUNCTION; Schema: util; Owner: - |
1740 | 1754 |
-- |
1741 | 1755 |
|
Also available in: Unified diff
schemas/util.sql: derived_cols_populate(): only run if needed