Re: How to get triggeroid by triggername in postgres 8.0

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to get triggeroid by triggername in postgres 8.0
Дата
Msg-id 21979.1113837490@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to get triggeroid by triggername in postgres 8.0  (Rafaqat Ali <smoken0@gmail.com>)
Список pgsql-hackers
Rafaqat Ali <smoken0@gmail.com> writes:
>        Can any one tell me how can I get triggerOid from triggerName
> in c code. I first tried to use SearchSysCache Function but it does
> not search o the basis of triggername.

Posting the same question three times on two different lists doesn't
endear you to anyone.

Anyway: you can't get the OID from triggername alone, because that's
not unique.  You need also the OID of the table the trigger is on.
There is not currently a syscache for this, probably because no such
lookup is needed in any heavily used code paths (we tend to rely on
the trigger lists stored in relcache entries, instead).  So there are
two ways to get the info about a particular trigger. One is a search of
the physical pg_trigger table --- see DropTrigger for one example.  The
other way is to open the relation cache entry (eg, with heap_open) and
look through its TriggerDesc array.  In many situations you'll already
have access to the Relation entry and so the second way is clearly a win.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Win32 presentation
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Call to build-in operator from new operator