/*** uninstall file to drop all objects created by the extension pgsql_tweaks ***/

BEGIN;

DROP FUNCTION IF EXISTS is_empty(TEXT);
DROP FUNCTION IF EXISTS is_empty_b(TEXT);
DROP FUNCTION IF EXISTS array_sum(BIGINT[]);
DROP FUNCTION IF EXISTS array_sum(INTEGER[]);
DROP FUNCTION IF EXISTS array_sum(SMALLINT[]);
DROP FUNCTION IF EXISTS array_sum(REAL[]);
DROP FUNCTION IF EXISTS array_sum(DOUBLE PRECISION[]);
DROP FUNCTION IF EXISTS array_sum(NUMERIC[]);
DROP FUNCTION IF EXISTS array_avg(BIGINT[]);
DROP FUNCTION IF EXISTS array_avg(INTEGER[]);
DROP FUNCTION IF EXISTS array_avg(SMALLINT[]);
DROP FUNCTION IF EXISTS array_avg(REAL[]);
DROP FUNCTION IF EXISTS array_avg(DOUBLE PRECISION[]);
DROP FUNCTION IF EXISTS array_avg(NUMERIC[]);
DROP FUNCTION IF EXISTS array_min(TEXT[]);
DROP FUNCTION IF EXISTS array_min(BIGINT[]);
DROP FUNCTION IF EXISTS array_min(INTEGER[]);
DROP FUNCTION IF EXISTS array_min(SMALLINT[]);
DROP FUNCTION IF EXISTS array_min(REAL[]);
DROP FUNCTION IF EXISTS array_min(DOUBLE PRECISION[]);
DROP FUNCTION IF EXISTS array_min(NUMERIC[]);
DROP FUNCTION IF EXISTS array_max(TEXT[]);
DROP FUNCTION IF EXISTS array_max(BIGINT[]);
DROP FUNCTION IF EXISTS array_max(INTEGER[]);
DROP FUNCTION IF EXISTS array_max(NUMERIC[]);
DROP FUNCTION IF EXISTS array_max(REAL[]);
DROP FUNCTION IF EXISTS array_max(DOUBLE PRECISION[]);
DROP FUNCTION IF EXISTS array_max(SMALLINT[]);
DROP FUNCTION IF EXISTS array_trim(TEXT[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(SMALLINT[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(INTEGER[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(BIGINT[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(NUMERIC[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(REAL[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(DOUBLE PRECISION[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(DATE[], BOOLEAN);
DROP FUNCTION IF EXISTS array_trim(TIMESTAMP[], rBOOLEAN);
DROP FUNCTION IF EXISTS array_trim(TIMESTAMP WITH TIME ZONE[], rd BOOLEAN);
DROP FUNCTION IF EXISTS to_unix_timestamp(TIMESTAMP WITH TIME ZONE);
DROP FUNCTION IF EXISTS to_unix_timestamp(TIMESTAMP);
DROP FUNCTION IF EXISTS datetime_de(TIMESTAMP WITH TIME ZONE,BOOLEAN);
DROP FUNCTION IF EXISTS date_de(d DATE);
DROP AGGREGATE IF EXISTS gap_fill(ANYELEMEN);
DROP FUNCTION IF EXISTS gap_fill_internal(ANYELEMEN, ANYELEMEN);
DROP FUNCTION IF EXISTS replace_latin1(TEXT, TEXT[], []);
DROP FUNCTION IF EXISTS replace_latin1(TEXT, TEXT);
DROP FUNCTION IF EXISTS replace_latin1(TEXT);
DROP FUNCTION IF EXISTS replace_encoding(TEXT, TEXT[], TEXT[]);
DROP FUNCTION IF EXISTS replace_encoding(TEXT, TEXT, TEXT);
DROP FUNCTION IF EXISTS replace_encoding(TEXT, TEXT);
DROP FUNCTION IF EXISTS return_not_part_of_encoding(TEXT, TEXT);
DROP FUNCTION IF EXISTS return_not_part_of_latin1(TEXT);
DROP FUNCTION IF EXISTS is_latin1(TEXT);
DROP FUNCTION IF EXISTS is_encoding(TEXT, TEXT, TEXT);
DROP FUNCTION IF EXISTS is_encoding(TEXT, TEXT);
DROP FUNCTION IF EXISTS pg_schema_size(TEXT);
DROP FUNCTION IF EXISTS is_bigint(TEXT);
DROP FUNCTION IF EXISTS is_integer(TEXT);
DROP FUNCTION IF EXISTS is_smallint(TEXT);
DROP FUNCTION IF EXISTS is_numeric(TEXT);
DROP FUNCTION IF EXISTS is_real(TEXT);
DROP FUNCTION IF EXISTS is_double_precision(TEXT);
DROP FUNCTION IF EXISTS is_boolean(TEXT);
DROP FUNCTION IF EXISTS is_json(TEXT);
DROP FUNCTION IF EXISTS is_timestamp(TEXT, TEXT);
DROP FUNCTION IF EXISTS is_timestamp(TEXT);
DROP FUNCTION IF EXISTS is_time(TEXT, TEXT);
DROP FUNCTION IF EXISTS is_time(TEXT);
DROP FUNCTION IF EXISTS is_date(TEXT, TEXT);
DROP FUNCTION IF EXISTS is_json(TEXT);
DROP FUNCTION IF EXISTS is_jsonb(TEXT);
DROP FUNCTION IF EXISTS is_hex(TEXT);
DROP FUNCTION IF EXISTS is_uuid(TEXT);
DROP FUNCTION IF EXISTS hex2bigint(TEXT);
DROP FUNCTION IF EXISTS is_bigint_array(TEXT);
DROP FUNCTION IF EXISTS is_integer_array(TEXT);
DROP FUNCTION IF EXISTS is_smallint_array(TEXT);
DROP FUNCTION IF EXISTS is_text_array(TEXT);
DROP FUNCTION IF EXISTS role_inheritance(TEXT);
DROP FUNCTION IF EXISTS function_get_markdown_doku_by_schema(TEXT, TEXT);
DROP VIEW IF EXISTS pg_functions;
DROP VIEW IF EXISTS pg_foreign_keys;
DROP VIEW IF EXISTS pg_db_views;
DROP VIEW IF EXISTS pg_table_matview_infos;
DROP VIEW IF EXISTS pg_object_ownership;
DROP VIEW IF EXISTS pg_bloat_info;
DROP VIEW IF EXISTS pg_unused_indexes;
DROP VIEW IF EXISTS pg_partitioned_tables_infos;
DROP VIEW IF EXISTS pg_table_bloat;
DROP VIEW IF EXISTS pg_active_locks;
DROP VIEW IF EXISTS pg_missing_indexes;
DROP VIEW IF EXISTS pg_role_permissions;
DROP VIEW IF EXISTS pg_role_infos;
DROP VIEW IF EXISTS statistics_top_ten_query_times;
DROP VIEW IF EXISTS statistics_top_ten_query_average_time_in_seconds;
DROP VIEW IF EXISTS statistics_top_ten_time_consuming_queries
DROP VIEW IF EXISTS statistics_top_ten_memory_usage_queries;
DROP VIEW IF EXISTS statistics_top_ten_called_queries;
DROP VIEW IF EXISTS statistics_top_ten_rows_returned_queries;
DROP VIEW IF EXISTS statistics_top_ten_shared_block_hits_queries;
DROP VIEW IF EXISTS statistics_top_ten_block_writes_queries;
DROP VIEW IF EXISTS statistics_top_ten_wal_records_generated_queries;
DROP VIEW IF EXISTS statistics_query_activity;
DROP VIEW IF EXISTS monitoring_wal;
DROP VIEW IF EXISTS monitoring_wal_archiving;
DROP VIEW IF EXISTS monitoring_active_locks;
DROP VIEW IF EXISTS monitoring_replication;
DROP VIEW IF EXISTS monitoring_database_conflicts;
DROP VIEW IF EXISTS monitoring_blocked_and_blocking_activity;
DROP VIEW IF EXISTS monitoring_follower_wal_status;
DROP VIEW IF EXISTS monitoring_vacuum;

END;
