bugfix: derived_col_constraint_initially_enabled(): must be both already enabled and unchanged to be initially enabled (r14240 was only partially correct)
schemas/util.sql: derived_cols_trigger_update(): to regenerate instructions: use util.derived_cols_update(), which also performs other updates
schemas/util.sql: derived_cols_sync(): renamed to derived_cols_trigger_update() for clarity
schemas/util.sql: added derived_cols_update()
schemas/util.sql: derived_col_update(): add comment describing how to modify derived column
schemas/util.sql: added quote_typed(derived_col_def)
schemas/util.sql: added quote_typed(col)
schemas/util.sql: derived_cols_sync(): table__fill_derived(): document in the function comment how to regenerate it
schemas/util.sql: added mk_set_comment(regprocedure, text)
schemas/util.sql: set_comment(): accept anything with a mk_set_comment()
fix: schemas/util.sql: check_constraint_expr_disable(): need to use CASE instead of `true OR ` because OR always evaluates both sides, slowing down constraint evaluation
fix: schemas/util.sql: check_constraint view: conrelid: don't cast to regclass so can use index scan
bugfix: derived_col_constraint_initially_enabled(): use whether existing constraint is already enabled, not whether expr is unchanged (which does not affect the enabled status)
schemas/util.sql: check_constraint_canon_sql(): use util.debug_print_return_value() to assist debugging
bugfix: schemas/util.sql: check_constraint_replace(): need to use util.check_constraint_canon_sql() instead of util.canon_sql()
schemas/util.sql: added check_constraint_canon_sql(). this must be used instead of plain util.canon_sql() because unlike queries, CHECK constraints are not simplified, just standardized.
schemas/util.sql: check_constraint_replace(): support not canon-ing def.expr
bugfix: schemas/util.sql: CHECK constraint exprs: need to remove the enclosing () to be consistent everywhere
bugfix: schemas/util.sql: canon_sql(): need to include the enclosing () because the DB includes them
fix: schemas/util.sql: canon_sql(): use explain()'s verbose mode to facilitate debugging
bugfix: schemas/util.sql: explain(): need to restore NOTICEs in verbose mode
schemas/util.sql: explain(): support running in verbose mode
bugfix: schemas/util.sql: check_constraint_replace(): need to canon the expr, using new util.canon_sql(), so it can be compared with the expr in the DB
schemas/util.sql: added canon_sql(expr text, table_ regclass)
fix: schemas/util.sql: check_constraint view: don't use pretty-print mode, because this format does not match util.canon_sql()
fix: schemas/util.sql: check_constraint_expr_enable(), derived_col_expr_from_check_constraint(): trim parens in order to support non-pretty-print mode, which is needed with canon_sql()
schemas/util.sql: added canon_sql(expr text)
schemas/util.sql: added trim_parens()
schemas/util.sql: added copy_struct(from_ regtype, to_ text) and copy_data(from_ regtype, to_ text), and use these in a general-purpose copy()
bugfix: schemas/util.sql: copy(from_ regtype, to_ text): must be declared STRICT to handle NULL properly
schemas/util.sql: added copy(from_ regtype, to_ text)
fix: schemas/util.sql: is_raise_condition(): should be called is_log_level()
schemas/util.sql: raise(): support SQLSTATE values
bugfix: schemas/util.sql: raise_expr(raise_type): only treat as raise condition if not SQLSTATE, to allow custom SQLSTATEs
schemas/util.sql: added raise_expr(raise_type)
schemas/util.sql: added is_raise_condition()
schemas/util.sql: added is_sqlstate()
schemas/util.sql: typeof(expr text, table_ regtype): use simpler util.eval2val() instead of EXECUTE
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
schemas/util.sql: derived_col_update(): use new util.derived_col_constraint_initially_enabled()
schemas/util.sql: added derived_col_constraint_initially_enabled()
schemas/util.sql: added derived_col_expr(col)
derived_col_constraint_enable(): documented that this now avoids re-running constraint on all rows if already enabled
fix: check_constraint_replace(): avoid re-running the constraint on all rows if expr hasn't changed
schemas/util.sql: check_constraint_replace(): shortened param to `def` for readability
schemas/util.sql: added check_constraint_expr(constraint_ table_item)
schemas/util.sql: added derived_col_update()
schemas/util.sql: check_constraint__disabled(): made disabled configurable (renaming func to check_constraint())
schemas/util.sql: added derived_col_constraint_expr()
schemas/util.sql: derived_col_constraints_enable(): use new derived_col_constraint_enable()
schemas/util.sql: added derived_col_constraint_enable()
schemas/util.sql: added table_has_data()
schemas/util.sql: added col_add(derived_col_def)
schemas/util.sql: added typeof(text, regclass)
schemas/util.sql: added regtype(regclass)
schemas/util.sql: added col_add()
schemas/util.sql: added col_def type
schemas/util.sql: derived_cols_populate(): only run if needed
schemas/util.sql: added derived_cols_populated()
schemas/util.sql: added derived_col_populated()
schemas/util.sql: added check_constraint_enabled()
schemas/util.sql: remove_prefix(), remove_suffix(): use new starts_with(), ends_with()
schemas/util.sql: added starts_with(), ends_with()
schemas/util.sql: derived_cols_populate(): also run util.derived_col_constraints_enable() once populated
schemas/util.sql: added derived_col_constraints_enable()
schemas/util.sql: added check_constraint__disabled(), which creates a CHECK constraint which is initially disabled
fix: schemas/util.sql: run_triggers(): need to re-sort rows if table needs this
schemas/util.sql: added try_cluster()
schemas/util.sql: added derived_cols_populate()
schemas/util.sql: added run_triggers(regclass)
schemas/util.sql: added first_col(regclass)
fix: schemas/util.sql: read-only functions should be STABLE rather than VOLATILE
bugfix: schemas/util.sql: functions that access the DB must be STABLE rather than IMMUTABLE
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
bugfix: schemas/util.sql: remove_prefix(), remove_suffix(): must be declared STRICT to handle NULL properly
bugfix: schemas/util.sql: remove_suffix(): need to use quote_nullable(str) so a NULL str doesn't NULL out the entire message
bugfix: schemas/util.sql: remove_prefix(): need to use quote_nullable(str) so a NULL str doesn't NULL out the entire message
bugfix: schemas/util.sql: raise(): use new quote_as_str() to avoid "RAISE statement option cannot be null" errors
schemas/util.sql: added quote_as_str()
schemas/util.sql: added CAST (util.col AS util.derived_col_def)
schemas/util.sql: derived_col_def(col): use existing util.check_constraint_def()
schemas/util.sql: added CAST (util.col AS util.table_item)
schemas/util.sql: added derived_col_def(col)
schemas/util.sql: added check_constraint_disable()
bugfix: schemas/util.sql: check_constraint_drop(): need IF EXISTS
schemas/util.sql: added check_constraint_expr_disable()
schemas/util.sql: check_constraint_enable(): documented that this is idempotent
schemas/util.sql: derived_cols_sync(): also create trigger, since this is necessary for a complete sync
schemas/util.sql: added name(regprocedure)
schemas/util.sql: derived_cols_sync(): set the trigger name in a var
schemas/util.sql: added check_constraint_enable()
schemas/util.sql: added check_constraint_replace()
schemas/util.sql: added CAST (util.table_item AS util.check_constraint_def)
schemas/util.sql: added check_constraint_drop()
schemas/util.sql: derived_col_expr_from_check_constraint(): enable initially-disabled exprs
schemas/util.sql: added check_constraint_expr_enable()