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
inputs/.TNRS/schema.sql: taxon_match: documented that whenever columns are renamed, util.derived_cols_sync() should be run
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()
fix: schemas/util.sql: check_constraint view: def: use pg_get_expr() with pretty-print, to avoid extra () that complicate parsing
inputs/.TNRS/schema.sql: taxon_match__fill_derived(): updated using new util.derived_cols_sync()
schemas/util.sql: added derived_cols_sync()
bugfix: CAST (util.check_constraint_def AS util.derived_col_def): need to extract the derived column expr from the CHECK constraint expr
schemas/util.sql: added derived_col_expr_from_check_constraint()
schemas/util.sql: added extract_str()
schemas/util.sql: added remove_suffix()
schemas/util.sql: added remove_prefix()
schemas/util.sql: added CAST (util.table_item AS util.col)
schemas/util.sql: derived_col_defs(): return derived_col_def instead of check_constraint_def
schemas/util.sql: added derived_col_def type with cast from util.check_constraint_def
schemas/util.sql: added derived_col_defs()
schemas/util.sql: check_constraint_defs(): use new util.check_constraint view
schemas/util.sql: added check_constraint view
schemas/util.sql: added check_constraint_defs()
schemas/util.sql: added check_constraint_def type
schemas/util.sql: added table_item type
schemas/util.sql: col_ref: renamed to just col
fix: inputs/.TNRS/schema.sql: taxon_match: to populate a new column: also need to recluster table so rows are exported in sorted order
schemas/util.sql: cluster(): support omitting index to recluster a table
schemas/util.sql: cluster_once(): use util.cluster()
schemas/util.sql: cluster_once(): documented that this runs cluster only once if called repeatedly
schemas/util.sql: added cluster(), which reclusters each time
schemas/util.sql: cluster_once(): use simpler `LANGUAGE sql` now that we're using util.eval() instead of EXECUTE
schemas/util.sql: cluster_once(): use util.eval() instead of EXECUTE to print the CLUSTER statement (if any) it's using
fix: inputs/.TNRS/schema.sql: taxon_match: cluster the table so the rows are always exported in the same order, even when an UPDATE statement is used to run triggers
bugfix: schemas/util.sql: cluster_once(): need to use just the name of the index, without the schema prefix
schemas/util.sql: cluster_once(): use simpler IS DISTINCT FROM instead of array !=
inputs/.TNRS/schema.sql: added _accepted{genus,specific_epithet} derived column, using the steps at wiki.vegpath.org/Postgres_queries#maintaining-derived-column-formulas-across-column-renames
schemas/vegbien.ERD.mwb: updated
fix: inputs/.TNRS/schema.sql: taxon_match: added back * prefixes on TNRS-namespace column names
inputs/.TNRS/schema.sql: MatchedTaxon: taxon_best_match: don't alias to `s` since this is no longer a nested select
inputs/.TNRS/schema.sql: MatchedTaxon: nested select: use just taxon_best_match since this no longer performs renamings
inputs/.TNRS/schema.sql: MatchedTaxon: renamed output columns to match input columns, so that the nested select would not be performing any renamings
fix: inputs/.TNRS/schema.sql: MatchedTaxon: added all columns from taxon_match (some of them apparently hadn't been included in MatchedTaxon)
fix: inputs/.TNRS/schema.sql: reordered columns to match taxon_match
fix: inputs/.TNRS/schema.sql: added back Family_matched, which had gotten merged with Name_matched_accepted_family when TNRS temporarily stopped populating Name_matched_accepted_family
inputs/.TNRS/schema.sql: MatchedTaxon: taxonomicStatus: moved outside the inner SELECT so that the inner SELECT would consist solely of renamings
inputs/.TNRS/schema.sql: MatchedTaxon: removed unneeded "Name_matched." prefix on source-specific names (only the * is needed because there is only one table)
bugfix: schemas/util.sql: view_is_subset(): auto-updatable views that are not plain subsets: include ones with WHERE clauses
bugfix: schemas/util.sql: view_is_subset(): also need to handle auto-updatable views that are not plain subsets (there are some of these)
schemas/public_.sql: removed no longer used threatened_taxonlabel. use iucn_red_list instead.
fix: schemas/public_.sql: analytical_stem_view: don't use threatened_taxonlabel, which was never populated correctly. instead, this can eventually be rewritten to use new iucn_red_list.
bugfix: schemas/public_.sql: analytical_stem_view_modify(): added columns: need to include COMMENT statements
bugfix: schemas/util.sql: comment(element oid): need `objsubid = 0` filter so this doesn't use comments for any other objsubids
schemas/public_.sql: added iucn_red_list_view_modify() and use it in iucn_red_list_view's "after updating this" instructions
bugfix: schemas/util.sql: rematerialize_view(): also need to handle the target table's dependent views
bugfix: schemas/util.sql: mk_drop_from_create(): need to use `IF EXISTS` so that the resulting statement also works if the target object does not yet exist
schemas/util.sql: mk_drop_from_create(): also support `SELECT util.drop_*()` statements, in addition to DROP
schemas/util.sql: replace_words(): use map_words() to enable inlining the concatenated hstore, so that it doesn't need to be concatenated on each function call
schemas/util.sql: added map_words()
schemas/util.sql: added date_from_spanish()
schemas/util.sql: added replace_words()
schemas/util.sql: added words(text)
schemas/util.sql: spanish_date_words(): switched to using hstore because this is better for the algorithm that will translate these
schemas/util.sql: added spanish_date_words()