Project

General

Profile

« Previous | Next » 

Revision 14213

fix: schemas/util.sql: derived_col_constraint_initially_enabled(): also should be initially enabled if expr unchanged, to avoid re-running constraint on all rows

View differences:

trunk/schemas/util.sql
1720 1720
CREATE FUNCTION derived_col_constraint_initially_enabled(def derived_col_def) RETURNS boolean
1721 1721
    LANGUAGE sql STABLE
1722 1722
    AS $$
1723
SELECT NOT util.table_has_data((def).col.table_) -- empty, so would always pass
1723
SELECT
1724
	def.expr IS NOT DISTINCT FROM util.derived_col_expr(def.col) -- unchanged
1725
OR	NOT util.table_has_data((def).col.table_) -- empty, so would always pass
1724 1726
$$;
1725 1727

  
1726 1728

  
......
1843 1845
-- if table has data:
1844 1846
SELECT util.derived_cols_populate(''table'');
1845 1847

  
1846
idempotent
1848
idempotent, and avoids re-running constraint on all rows if expr hasn''t changed
1847 1849
';
1848 1850

  
1849 1851

  

Also available in: Unified diff