I want regtrigger alias

Interesting situation happened to me today. I wanted to know details of some trigger. The first thing that came to mind is to use pg_get_triggerdef function.

But here we have problems:

  1. function doesn’t accept trigger name, but trigger oid only;
  2. there is no any regtrigger stuff just like for relations, types, procs etc.

So I need to execute something like

SELECT pg_get_triggerdef(oid) 
	FROM pg_trigger 
	WHERE tgname = 'foo_trigger';

instead of something like

SELECT pg_get_triggerdef('foo_table.foo_trigger'::regtrigger);

Not the big deal, one may think. But I want regtrigger stuff. 🙂

UPD: According to Marko’s comment, relation name included.

2 thoughts on “I want regtrigger alias

  1. Triggers are per-relation so the input syntax would also have to include the name of the relation. But I agree with you, you can never have too many reg* types 😉

    Like

Leave a comment