schemas/util.sql: added relation_type(character)
schemas/vegbien.sql: added rm_query_view(), which removes all DB objects related to a particular validations query
fix: schemas/vegbien.sql: remake_diff_tables(): need to set function option search_path in order to limit the effects of `SET LOCAL search_path` (mk_set_search_path()) to the current function
fix: schemas/vegbien.sql: query_views(): renamed to query_relations() because this also returns non-views
schemas/vegbien.sql: added public_validations.query_views()
schemas/util.sql: schema_matches(): should be IMMUTABLE, not STABLE, because it uses only parameter values
schemas/util.sql: added regexp_quote()
fix: schemas/util.sql: is_table(), is_view(): should be STABLE, not IMMUTABLE, because they reference tables
schemas/util.sql: added drop_relation()
schemas/util.sql: added is_table()
schemas/util.sql: added is_view()
bugfix: schemas/util.sql: show_views_like(): need to match the schema exactly, not via regexp like util.show_relations_like() does
schemas/util.sql: show_views_like(): use util.show_relations_like()
schemas/util.sql: show_views_like(): reversed argument order to match show_relations_like()
schemas/util.sql: added show_relations_like()
schemas/util.sql: added schema_matches()
schemas/vegbien.sql: remake_diff_tables(): updated runtime now that row limit has been removed (same, 45 min)
fix: schemas/vegbien.sql: _traits_07_trait_value_and_units, _traits_08_taxonname_trait_and_value_for_first_5000_records: removed LIMIT to match the input queries
schemas/util.sql: materialize_query(): ANALYZE the created table so that it has the correct estimated rowcount
schemas/util.sql: added analyze_()
schemas/vegbien.sql: remake_diff_tables(): updated bien2_traits runtime (45 min) to include the now-properly-renamed views 6-8
schemas/vegbien.sql: remake_diff_tables(): documented runtime for bien2_traits (30 min)
fix: schemas/vegbien.sql: renamed output views to match input views
schemas/vegbien.sql: _traits_01_count_records (output side): documented runtime (4 min)
bugfix: schemas/vegbien.sql: source_by_shortname(): resolved ambiguous column references by renaming PL/pgSQL vars and adding table qualifiers
bugfix: schemas/vegbien.sql: source_by_shortname(): changed from STABLE to VOLATILE because the search_path can only be set in VOLATILE functions
bugfix: schemas/vegbien.sql: source_by_shortname(): can't be declared STRICT because it now has a 2nd param (schema_anchor) which is always NULL
bugfix: schemas/vegbien.sql: remake_diff_tables(): can't raise exception at end if had errors, because this would roll back the transaction. instead use new util.raise_error_notice().
schemas/util.sql: added raise_error_notice()
schemas/vegbien.sql: added remake_diff_tables()
bugfix: schemas/util.sql: diff(text, text): also need to include only different rows when comparing single-row tables
schemas/vegbien.sql: added validation_views()
schemas/util.sql: show_views_like(): added predictable ordering
schemas/util.sql: added show_views_like()
schemas/util.sql: added schema_oid()
schemas/util.sql: remake_diff_table(): add comment on the diff table showing how to view it in human-readable form. (the table unfortunately cannot be materialized in human-readable form, because this would create column name collisions between the two sides.)
schemas/util.sql: added set_comment()
schemas/util.sql: added eval2records()
fix: schemas/util.sql: diff(regclass, regclass): display single row tables side-by-side
schemas/util.sql: diff(text, text): implemented the single_row feature
schemas/util.sql: diff(text, text): added single_row param (not implemented yet, to make reading the svn diff easier). to view this svn diff, it is helpful to use WinMerge, which offers moved block detection (/README.TXT > WinMerge setup).
fix: schemas/util.sql: remake_diff_table(): util.diff() call: include explicit types on arguments to ensure that the correct diff() variant is used
schemas/util.sql: added has_single_row()
schemas/vegbien.sql: remake_diff_table(): prepend ~ to the type table so that it sorts at the end, away from the main tables
bugfix: schemas/vegbien.sql: remake_diff_table(): can't have in_table/out_table inherit from each other, because inheritance also causes the rows of the parent table to be included in the child table. instead, they need to inherit from a common, empty table, as implemented by the new util.remake_diff_table().
schemas/util.sql: added remake_diff_table()
schemas/util.sql: drop_*(): added force param to use CASCADE mode
fix: schemas/util.sql: diff(regclass, regclass): usage: col_type_null must actually be a shared base type of the tables
fix: schemas/util.sql: diff(regclass, regclass): usage: text arguments must be cast to regclass to bind the right variant of diff()
fix: schemas/util.sql: diff(regclass, regclass): renamed params to *_table because these actually can't be views, since views don't support inheritance
schemas/util.sql: added copy_struct()
schemas/vegbien.sql: added remake_diff_table()
schemas/util.sql: added inherit()
bugfix: schemas/util.sql: diff(): need to explicitly cast each side to the return type because this does not happen automatically even when an implicit cast is available
schemas/util.sql: renamed diff_views(), diff_any() to diff(...) because they are overloads of the same operation
schemas/util.sql: diff_any(): documented how to run EXPLAIN on the FULL JOIN query
schemas/util.sql: removed non-useful diff_queries() (it is not possible to match distinct `record` types to a common return type, so this would not have worked). use diff_views() instead.
bugfix: schemas/util.sql: diff_queries(), diff_views(): embed views verbatim as FROM items, so that the type of their corresponding columns is the view's rowtype. this is necessary in order to match the types of the columns to the return type (set by col_type_null).
schemas/util.sql: diff_cols(): renamed to diff_queries() because multiple columns are supported
fix: schemas/util.sql: diff_cols(): don't assume that each side will have one column, as many of our validations queries have multiple columns
bugfix: schemas/util.sql: diff_views(): need to use $2, not $1, for the 2nd query
fix: schemas/util.sql: materialize_query(): remove any extra blank line before the query, to improve readability when newlines are used as a log message separator and are therefore confusing in the middle of a log message
schemas/util.sql: added ltrim_nl()
bugfix: schemas/vegbien.sql: setting search_path locally: also need to set function option search_path, in order to limit the effects of `SET LOCAL search_path` (mk_set_search_path()) to the current function (http://www.postgresql.org/docs/9.1/static/sql-set.html#AEN75423)
bugfix: schemas/vegbien.sql: setting search_path locally: need to use `SET LOCAL search_path TO` instead of `PERFORM set_config(search_path, ..., is_local := true)` because the meaning of is_local refers to the entire transaction, not just the current function (as for LOCAL)
schemas/util.sql: added mk_set_search_path(VARIADIC schemas text[])
schemas/util.sql: added mk_use_own_schema()
schemas/util.sql: added mk_set_search_path()
schemas/util.sql: use builtin string_agg(..., ) instead of concat()
schemas/util.sql: added qual_name(type unknown) to avoid needing to explicitly specify the type of an input string
schemas/util.sql: qual_name(table_ regclass): use ::text with search_path=pg_temp like qual_name(type regtype), rather than casting to text and then using qual_name(type regtype)
schemas/util.sql: type_qual_name(type regtype): renamed to qual_name(type regtype) to match qual_name(table_ regclass)
schemas/util.sql: added rematerialize_query()
schemas/vegbien.sql: added rematerialize_in_view()
schemas/vegbien.sql: rematerialize_out_view(): pass a schema-qualified name to util.rematerialize_view() to avoid depending on the search_path to create it in the right schema
schemas/vegbien.sql: materialize_query(): support schema-qualified tables. this requires escaping tables in calls to this function.
schemas/vegbien.sql: added rematerialize_out_view(in_view regclass)
schemas/util.sql: added qual_name()
schemas/vegbien.sql: added rematerialize_out_view(datasource_schema text, out_view regclass)
bugfix: schemas/vegbien.sql: source_by_shortname(): added schema_anchor so that it always applies to the schema it's defined in, even if `public` is not in the search_path
schemas/vegbien.sql: functions with schema_anchors: documented that they must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime changes of search_path (schema elements are bound at inline time rather than runtime)
bugfix: schemas/vegbien.sql: functions with schema_anchors: must use plpgsql for these because the sql language does not support runtime changes of search_path (the schema elements they use are bound at inline time rather than runtime)
schemas/vegbien.sql: schema_null param: renamed to schema_anchor to clarify what this is for
fix: schemas/vegbien.sql: schema_null: clarified that this should always be left as the default value, not just usually
schemas/vegbien.sql: schema_null params: use schema_anchor instead of source for this, since it is guaranteed to exist regardless of which tables are in the VegBIEN schema
schemas/vegbien.sql: public: added schema_anchor (used with schema_null params)
schemas/util.sql: use new util.debug_print_sql() instead of `RAISE NOTICE` to improve readability of the debug output (which is used throughout the runscripts)
schemas/util.sql: added debug_print_sql()
schemas/util.sql: added raise_notice(), to allow NOTICEs to be raised in sql-language functions
schemas/vegbien.sql: removed no longer used concat() aggregate. use builtin string_agg() instead.
schemas/util.sql: added rematerialize_view()
schemas/util.sql: schema(regtype), schema(regclass): use new schema(pg_namespace_oid oid)
schemas/util.sql: added schema(pg_namespace_oid oid)
schemas/util.sql: schema(regclass): use joins instead of nested SELECTs for consistency with schema(regtype)
schemas/util.sql: regenerated from DB, which reorders the functions
schemas/util.sql: table_name(): renamed to name(regclass) for consistency with other name(...) functions
schemas/util.sql: table_schema(): renamed to schema(regclass) for consistency with other schema(...) functions
schemas/util.sql: schema_ident(): renamed to schema_esc() for clarity
schemas/vegbien.sql: added schema_anchor, for use with schema_null params
schemas/util.sql: added mk_search_path()