Re: pl/pgsql trigger table attributes
От | Tom Lane |
---|---|
Тема | Re: pl/pgsql trigger table attributes |
Дата | |
Msg-id | 28670.1092595843@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | pl/pgsql trigger table attributes (Graeme Hinchliffe <graeme.hinchliffe@zeninternet.co.uk>) |
Список | pgsql-general |
Graeme Hinchliffe <graeme.hinchliffe@zeninternet.co.uk> writes: > The way I have written the pl/pgsql function is specific to the specific > table it is attached to, what I would like is a pl/pgsql function which > could be attached to any table to catch the changes. > Is there a way that a pl/pgsql function can determine the names of the > attributes in a table? This is somewhere between impractical and impossible in plpgsql; that language is not designed to handle access to fields with dynamically-determined names and datatypes. You could probably do it in pltcl, but if I were you I'd skip the PLs and go straight to coding it in C, because that's likely where you're going to end up anyway for performance reasons. There are some triggers in the contrib/ tree that do roughly similar things; perhaps you could use them as prototypes. Also consider whether you aren't re-inventing the wheel. It sounds to me like what you really want is a replication system ... have you looked at Slony? regards, tom lane
В списке pgsql-general по дате отправления: