Skip to content

Commit

Permalink
Utils - Ajout du statut actif pour la requête listant les triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
mdouchin committed Aug 7, 2024
1 parent 450321a commit 68399fe
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions docs/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,26 @@ SELECT
trigger_name,
string_agg(event_manipulation, ',') AS event,
action_timing AS activation,
action_condition AS condition,
action_condition AS condition,
CASE WHEN tgenabled = 'O' THEN True ELSE False END AS trigger_active,
action_statement AS definition
FROM information_schema.triggers
GROUP BY 1,2,3,4,6,7,8
FROM information_schema.triggers AS t
INNER JOIN pg_trigger AS p
ON p.tgrelid = concat('"', event_object_schema, '"."', event_object_table, '"')::regclass
AND trigger_name = tgname
WHERE True
GROUP BY 1,2,3,4,6,7,8,9
ORDER BY table_schema, table_name
;
```

Cette requête renvoie un tableau de la forme :

| table_schema | table_name | trigger_schema | trigger_name | event | activation | condition | definition |
|--------------|------------------------|----------------|----------------------|--------|------------|-----------|------------------------------------------------------|
| gestion | acteur | gestion | tr_date_maj | UPDATE | BEFORE | | EXECUTE FUNCTION occtax.maj_date() |
| occtax | organisme | occtax | tr_date_maj | UPDATE | BEFORE | | EXECUTE FUNCTION occtax.maj_date() |
| taxon | iso_metadata_reference | taxon | update_imr_timestamp | UPDATE | BEFORE | | EXECUTE FUNCTION taxon.update_imr_timestamp_column() |
| table_schema | table_name | trigger_schema | trigger_name | event | activation | condition | trigger_active | definition |
|--------------|------------------------|----------------|----------------------|--------|------------|-----------|--------------- |------------------------------------------------------|
| gestion | acteur | gestion | tr_date_maj | UPDATE | BEFORE | | f | EXECUTE FUNCTION occtax.maj_date() |
| occtax | organisme | occtax | tr_date_maj | UPDATE | BEFORE | | t | EXECUTE FUNCTION occtax.maj_date() |
| taxon | iso_metadata_reference | taxon | update_imr_timestamp | UPDATE | BEFORE | | t | EXECUTE FUNCTION taxon.update_imr_timestamp_column() |


## Lister les fonctions installées par les extensions
Expand Down

0 comments on commit 68399fe

Please sign in to comment.