Trigger function, C, lookup of attribute type

Поиск
Список
Период
Сортировка
От Paul
Тема Trigger function, C, lookup of attribute type
Дата
Msg-id 566FEE86.9020202@abelian.netcom.co.uk
обсуждение исходный текст
Ответы Re: Trigger function, C, lookup of attribute type  (Paul <Paul@abelian.netcom.co.uk>)
Re: Trigger function, C, lookup of attribute type  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-general
I'm writing a trigger procedure in C to catch updates to a
table and write them to a log file.

The function must walk along trigdata->tg_trigtuple
pulling out the attributes, comparing them with those in
trigdata->tg_newtuple and writing the diffs to a flat ASCII
file.

I've got a loop over the attributes, and I can get the values
if I know the type, eg

  Datum d = heap_getattr( trigdata->tg_trigtuple, ...
  int32_t val = DatumGetInt32( d);

but I'm struggling to find how the function can determine the
attribute types.   I'm only using the built-in scalar types.

Do I have to query the system catalogs?  Or maybe there's a
function that works from a TupleDesc?

--
Paul Nicholson
--


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

Предыдущее
От: Daniel Westermann
Дата:
Сообщение: Re: pg_dump executed on a hosts against another host fails with pg_dump: [archiver (db)] query was: SET search_path = pg_catalog, sys, dbo
Следующее
От: Edson Richter
Дата:
Сообщение: Re: Overhead changing varchar(2000) to text