Routines

Routines

Name Type Language Deterministic Return Type Security Restriction Comments
trig_a_i_syst_instances_create_instance_contexts() FUNCTION plpgsql false trigger INVOKER
trig_a_i_syst_instance_type_apps_create_inst_type_contexts() FUNCTION plpgsql false trigger INVOKER

When a new association between an Application and an Instance Type is made by inserting a record into this table, Instance Type Contexts are automatically created by this function based on the Application Context records defined at the time of INSERT into this table.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT

General Usage

The default default_db_pool_size value is 0.

After the fact changes to Contexts must be managed manually.

trig_a_iu_syst_instance_network_rule_ordering() FUNCTION plpgsql false trigger INVOKER

Ensures that the ordering of network rules is maintained and that ordering values are not duplicated.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT, UPDATE

trig_b_u_syst_hierarchies_validate_structured() FUNCTION plpgsql false trigger INVOKER

A trigger function which ensures that changing a hierarchy between being “structured” and “unstructured” is only possible when the Hierarchy record is in an “inactive” state.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: UPDATE

trig_b_u_syst_hierarchy_items_hierarchy_inactive_check() FUNCTION plpgsql false trigger DEFINER

Ensures that, if a functionally significant column is changed during an update operation, that the parent Hierarchy record is set to an “inactive” state.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: UPDATE

trig_a_iu_syst_global_network_rule_ordering() FUNCTION plpgsql false trigger INVOKER

Ensures that the ordering of network rules is maintained and that ordering values are not duplicated.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT, UPDATE

trig_b_iu_syst_hierarchy_items_depth_maint() FUNCTION plpgsql false trigger INVOKER

Manages the hierarchy_depth column value. Depending on the passed data, this trigger will perform different actions.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT, UPDATE

General Usage

When a new Hierarchy Item record is inserted without specifying a hierarchy_depth value, this trigger will assign it the next highest hierarchy_depth value based on the existing Hierarchy Item records assigned to the Hierarchy, or 1 if there are no existing Hierarchy Item records assigned to the Hierarchy.

When a new Hierarchy Item record is inserted specifying an explicit hierarchy_depth value, we assume that insertion is done with knowing intent and we will not change the inserted value in this trigger. hierarchy_depth values must be unique for any members of a single Hierarchy. In the case where the inserted record’s explicit hierarchy_depth value does not collide with a pre-existing value, we simply take that value as-is. When there is a collision, we take an “insert before” approach: the pre-existing record with which the new record collides has its hierarchy_depth value increased by 1; if this updated value in turn collides with another pre-existing record in the Hierarchy, we update this next record by incrementing its value by 1. This continues until all collisions in the Hierarchy are resolved to be unique.

Updated records follow the same patterns as inserted records, except that we do not expect that the update will attempt to NULL the hierarchy_depth value. If an update would leave a gap, we do not try to renumber the hierarchy_depth values meaning that the hierarchy_depth sequence within any Hierarchy may indeed include gaps: we only attempt to keep overall ordering consistent and we do not attempt to achieve a gapless numbering scheme.

trig_b_d_syst_hierarchy_items_hierarchy_inactive_check() FUNCTION plpgsql false trigger INVOKER

Verifies that the parent Hierarchy is in an “inactive” prior to allowing deletion of the Hierarchy Item record.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: DELETE

trig_b_i_syst_enum_functional_type_validate_new_allowed() FUNCTION plpgsql false trigger INVOKER

Checks to see if this is the first functional type being added for the enumeration and, if so, that no syst_enum_items records already exist.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT

General Usage

Adding a first functional type for an enumeration which already has defined enumeration items implies that the enumeration items must be assigned a functional type in the same operation to keep data consistency. In practice, this would be difficult since there would almost certainly have to be multiple functional types available in order to avoid making bogus assignments; it would be much more difficult to manage such a process as compared to simply disallowing the scenario.

trig_a_iu_syst_perm_role_grants_related_data_checks() FUNCTION plpgsql false trigger INVOKER

Checks that Permission Role Grant records are consistent with their defining parent records.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT, UPDATE

trig_b_i_syst_hierarchy_items_hierarchy_prereqs() FUNCTION plpgsql false trigger INVOKER

Validates that the Hierarchy conditions of being in an “inactive” state and that the Hierarchy is a “structured” Hierarchy are true.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT

trig_b_i_syst_enum_items_maintain_sort_order() FUNCTION plpgsql false trigger INVOKER

For INSERTed records with a null sort_order value, this trigger will assign a default value assuming the new record should be inserted at the end of the sort.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT

General Usage

If the inserted record was already assigned a sort_order value, the inserted value is respected.

trig_b_i_syst_hierarchies_validate_inactive() FUNCTION plpgsql false trigger INVOKER

Prevents Hierarchy records from being inserted in an already “active” state.

General Usage

Hierarchy records should be inserted “inactive” and then later made “active” once the record and its associate Hierarchy Item records are complete and valid.

trig_a_d_syst_credentials_delete_identity() FUNCTION plpgsql false trigger INVOKER

Deletes the syst_identities record associated with a newly deleted syst_credentials record.

For those credential types that expect a relationship to syst_identities via the syst_credentials.credential_for_identity_id column, the specific identifier and credential data are closely related and updates to one or the other makes no sense. The correct process for updating such a pair is to delete both of the existing identity and credential records and simply generate a new pair. Deleting identity records achieves this goal via the constraint on the credential_for_identity_id definition (ON DELETE CASCADE), but deleting a credential has no automatic deletion feature thus this trigger.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: DELETE

trig_b_d_syst_applications_delete_contexts() FUNCTION plpgsql false trigger INVOKER

Deletes the Application Contexts prior to deleting the Application record itself. This is needed because the trigger preventing datastore context owner contexts to be deleted must be disabled prior to the delete.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: DELETE

trig_b_iud_syst_application_contexts_validate_owner_context() FUNCTION plpgsql false trigger INVOKER

Validates database_owner_context values based on the pre-existing state of the database.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT, UPDATE, DELETE

trig_b_iu_syst_enum_items_validate_functional_types() FUNCTION plpgsql false trigger INVOKER

Ensures that if the parent syst_enums record has syst_enum_functional_types records defined, a syst_enum_items record will reference one of those functional types.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT, UPDATE

General Usage

Note that this trigger function is intended to be use by constraint triggers.

trig_a_iu_syst_enum_items_maintain_sort_order() FUNCTION plpgsql false trigger INVOKER

Automatically maintains the sort order of syst_enum_item records in cases where sort ordering collides with existing syst_enum_items records for the same enum_id.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT, UPDATE

General Usage

On insert or update when the new sort_order value matches that of an existing record for the enumeration, the system will sort the match record after the new/updated record. This will cascade for all syst_enum_items records matching the enum_id until the last one is updated.

trig_a_iu_syst_owner_network_rule_ordering() FUNCTION plpgsql false trigger INVOKER

Ensures that the ordering of network rules is maintained and that ordering values are not duplicated.

Trigger Function Details:

  • Supported Timing: AFTER

  • Supported Operations: INSERT, UPDATE

trig_b_iu_syst_perm_role_grants_default_scopes() FUNCTION plpgsql false trigger INVOKER

This trigger will assign default Permmission Scope values based on the definition of the permission defined in Permissions’ ms_syst_data.syst_perms record.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT, UPDATE

trig_b_u_syst_hierarchies_validate_state_change() FUNCTION plpgsql false trigger INVOKER

Checks that a Hierarchy record’s state may be changed while ensuring that such a change doesn’t allow for data inconsistencies with either of the Hierarchy or the data of Hierarchy implementing Components.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: UPDATE

General Usage

Setting the Hierarchy to an “active” state requires that the Hierarchy and its associated Hierarchy Items are complete and fully self-consistent. For the “inactive” check, the Hierarchy may not be in use which is defined as being referenced in the data of Hierarchy implementing Components.

trig_b_d_syst_hierarchies_validate_prereqs() FUNCTION plpgsql false trigger INVOKER

Validates that a Hierarchy is no longer referenced by the data of Hierarchy implementing Components prior to allowing that Hierarchy being deleted.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: DELETE

General Usage

Note that references from associated Hierarchy Item records do not count as “references” and that deleting their parent Hierarchy record will cascade to the Hierarchy Item records.

trig_b_i_syst_identities_validate_uniqueness() FUNCTION plpgsql false trigger INVOKER

Provides a check that each ms_syst_data.syst_identities.account_identifier value is unique for each owner’s access accounts or unique amongst unowned access accounts.

Trigger Function Details:

  • Supported Timing: BEFORE

  • Supported Operations: INSERT