Schema ``trigger`` ================== Tables ------ rule ^^^^ +-----------------------+----------+----------+-------------+ | Column | Type | Nullable | Description | +=======================+==========+==========+=============+ | id | integer | ✘ | | +-----------------------+----------+----------+-------------+ | name | name | ✔ | | +-----------------------+----------+----------+-------------+ | notification_store_id | integer | ✔ | | +-----------------------+----------+----------+-------------+ | granularity | interval | ✔ | | +-----------------------+----------+----------+-------------+ | default_interval | interval | ✔ | | +-----------------------+----------+----------+-------------+ | enabled | bool | ✘ | | +-----------------------+----------+----------+-------------+ rule_trend_store_link ^^^^^^^^^^^^^^^^^^^^^ Stores the dependencies between a trigger rule and its source table trend store parts. Multiple levels of views and functions may exist between a materialization and its source table trend stores. These intermediate views and functions are not registered here, but only the table trend stores containing the actual source data used in the trigger rule. The timestamp_mapping_func column stores the function to map a timestamp of the source (trend_store_part) to a timestamp of the target notification. +------------------------+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Column | Type | Nullable | Description | +========================+==============+==========+=================================================================================================================================================================================================================================================================+ | rule_id | integer | ✘ | Reference to a trigger rule. | +------------------------+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | trend_store_part_id | integer | ✘ | Reference to a trend_store_part that is a source of the materialization referenced by materialization_id. | +------------------------+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | timestamp_mapping_func | regprocedure | ✘ | The function that maps timestamps in the source table to timestamps in the materialized data. For example, for a view for an hour aggregation from 15 minute granularity data will need to map 4 timestamps in the source to 1 timestamp in the resulting data. | +------------------------+--------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ exception_base ^^^^^^^^^^^^^^ +-----------+--------------------------+----------+-------------+ | Column | Type | Nullable | Description | +===========+==========================+==========+=============+ | id | integer | ✘ | | +-----------+--------------------------+----------+-------------+ | entity_id | integer | ✔ | | +-----------+--------------------------+----------+-------------+ | start | timestamp with time zone | ✔ | | +-----------+--------------------------+----------+-------------+ | expires | timestamp with time zone | ✔ | | +-----------+--------------------------+----------+-------------+ | created | timestamp with time zone | ✔ | | +-----------+--------------------------+----------+-------------+ rule_tag_link ^^^^^^^^^^^^^ +---------+---------+----------+-------------+ | Column | Type | Nullable | Description | +=========+=========+==========+=============+ | rule_id | integer | ✘ | | +---------+---------+----------+-------------+ | tag_id | integer | ✘ | | +---------+---------+----------+-------------+ Functions --------- table_exists(schema_name name, table_name name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ view_exists(schema_name name, table_name name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action(anyelement, sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action(anyelement, sql text[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with_threshold_view_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weight_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exception_weight_table_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exception_threshold_table_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_rule(name) ^^^^^^^^^^^^^^ add_rule(name) ^^^^^^^^^^^^^^ define(name) ^^^^^^^^^^^^ threshold_view_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rule_view_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_rule_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rule_view_sql(trigger.rule, where_clause text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_rule_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_rule_view_sql(trigger.rule, rule_view_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_rule_view(trigger.rule, rule_view_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ kpi_view_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ kpi_function_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_kpi_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ kpi_view_sql(trigger.rule, sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_kpi_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_kpi_function_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_kpi_view_sql(trigger.rule, sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_kpi_view(trigger.rule, sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ kpi_type_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ details_type_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_threshold_test_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_test_threshold_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_with_threshold_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_threshold_defs(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with_threshold_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_with_threshold_view(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_with_threshold_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_weight_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ weight_fn_sql(trigger.rule, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_weight_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ exception_weight_table_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_exception_weight_table(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_exception_weight_table_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_type_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notification_type_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_notification_type_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notification_type(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_exception_threshold_table_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_kpi_defs(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^ get_kpi_def(trigger.rule, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_exception_threshold_table_sql(trigger.rule, name[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_exception_threshold_table(trigger.rule, name[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_thresholds_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_thresholds(trigger.rule, exprs text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_set_thresholds_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_set_thresholds_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_set_thresholds_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_thresholds_view_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_thresholds(name, exprs text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_dummy_thresholds(trigger.rule, name[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_weight(trigger.rule, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_weight(name, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_dummy_default_weight(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add_insert_trigger(notification_directory.notification_store) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_trigger_notification_store(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ transfer_notifications_from_staging(notification_directory.notification_store) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(trigger.rule, notification_directory.notification_store, timestamp with time zone) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(trigger.rule, timestamp with time zone) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(trigger.rule, notification_directory.notification_store, interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(trigger.rule, interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(rule_name name, notification_store_name name, timestamp with time zone) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(rule_name name, timestamp with time zone) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(rule_name name, notification_store_name name, interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(rule_name name, interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notifications(rule_name name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with_threshold_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ kpi_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^ fingerprint_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rule_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^ runnable_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_message_fn_name(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_kpi_type_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_details_type_sql(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_details_type_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_details_type(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_details_type(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_dummy_thresholds(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_exception_threshold_table_sql(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_exception_threshold_table(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with_threshold_fn_sql_normal(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ with_threshold_fn_sql_no_thresholds(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ has_thresholds(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Return true if there is a view with thresholds for the specified rule with_threshold_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_with_threshold_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_with_threshold_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ define_thresholds(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_message_fn_sql(trigger.rule, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_notification_message_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notification_message_fn(trigger.rule, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_dummy_notification_message_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ define_notification_message(name, expression text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rule_fn_sql(trigger.rule, where_clause text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_rule_fn_sql(trigger.rule, rule_view_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_rule_fn(trigger.rule, rule_view_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_rule_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_condition(trigger.rule, sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ notification_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notification_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_notification_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ get_notification_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_notification_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_fingerprint_fn_sql(trigger.rule, fn_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_fingerprint_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_fingerprint_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_fingerprint_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_fingerprint_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_runnable_fn_sql(trigger.rule, fn_body text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_runnable_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_runnable_fn(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ drop_runnable_fn_sql(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ set_runnable(trigger.rule, fn_sql text) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ setup_rule(trigger.rule, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ create_rule(name, trigger.threshold_def[]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cleanup_rule(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^^^ delete_rule(name) ^^^^^^^^^^^^^^^^^ tag(tag_name varchar, rule_id integer) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Add tag with name tag_name to rule with id rule_id. The tag must already exist. truncate(timestamp with time zone, interval) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ timestamps(trigger.rule) ^^^^^^^^^^^^^^^^^^^^^^^^