List triggers and their content

Is there a way to edit/list triggers and their content? I've created one by using SQL as the UI is a bit limited
CREATE TRIGGER trigger_apply_discount
AFTER UPDATE OF used, used_by_order ON discount_codes
FOR EACH ROW
WHEN (NEW.used = TRUE AND OLD.used = FALSE)
EXECUTE FUNCTION apply_discount_to_order();
CREATE TRIGGER trigger_apply_discount
AFTER UPDATE OF used, used_by_order ON discount_codes
FOR EACH ROW
WHEN (NEW.used = TRUE AND OLD.used = FALSE)
EXECUTE FUNCTION apply_discount_to_order();
3 Replies
ihm40
ihm40•2w ago
i think that given your trigger is a bit more complicated than i have seen before you will have to also use SQL to see it
SELECT
tgname AS trigger_name,
pg_catalog.pg_get_triggerdef(oid) AS trigger_definition
FROM pg_trigger
WHERE tgname = 'trigger_apply_discount';
SELECT
tgname AS trigger_name,
pg_catalog.pg_get_triggerdef(oid) AS trigger_definition
FROM pg_trigger
WHERE tgname = 'trigger_apply_discount';
This might work for you
telesto🌛
telesto🌛OP•2w ago
it does! tysm. I think I'm fine with it being this way, I can still use sql to edit it when needed
ihm40
ihm40•2w ago
yeah exactly

Did you find this page helpful?