Project

General

Profile

« Previous | Next » 

Revision 14273

bugfix: schemas/util.sql: derived_col_update(): don't set_comment() until CHECK constraint exists so that we can use its canon-ed formula

View differences:

util.sql
1967 1967
    LANGUAGE sql
1968 1968
    AS $$
1969 1969
SELECT util.col_add(def);
1970

  
1971
-- if table has data, initially disabled because not yet populated
1972
SELECT util.check_constraint((def.col, util.derived_col_constraint_expr(def)),
1973
	enabled := util.derived_col_constraint_initially_enabled(def));
1974

  
1975
-- once CHECK constraint exists so that we can use its canon-ed formula
1970 1976
SELECT util.set_comment(def.col, '
1971
derived column; = '||def.expr||'
1977
derived column; = '||util.derived_col_expr(def.col)||'
1972 1978

  
1973 1979
to modify:
1974 1980
SELECT util.derived_col_update('||util.quote_typed(def)||');
1975 1981
SELECT util.derived_cols_populate('||util.quote_typed((def).col.table_)||');
1976 1982
');
1977 1983

  
1978
-- if table has data, initially disabled because not yet populated
1979
SELECT util.check_constraint((def.col, util.derived_col_constraint_expr(def)),
1980
	enabled := util.derived_col_constraint_initially_enabled(def));
1981

  
1982 1984
SELECT util.derived_cols_trigger_update((def).col.table_);
1983 1985
$$;
1984 1986

  

Also available in: Unified diff