Re: [GENERAL] logical decoding output plugin

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: [GENERAL] logical decoding output plugin
Дата
Msg-id 20161210231021.fwj3ff6haau3z4ak@alap3.anarazel.de
обсуждение исходный текст
Ответ на [GENERAL] logical decoding output plugin  (Torsten Förtsch <tfoertsch123@gmail.com>)
Список pgsql-general
Hi,

On 2016-12-10 22:34:02 +0100, Torsten Förtsch wrote:
> I am working on a logical decoding output plugin. I am only interested in
> the changes in one particular table.
>
> One way to check for the table would be to compare class_form->relname
> and get_namespace_name(class_form->relnamespace). But I'd much prefer to
> just compare the OID of the table.
>
> Is there a cheap way to do something like "SELECT
> 'schema.table'::regclass::oid" that can be called in the startup callback?

You shouldn't do it in the startup callback (no catalog access there),
but you can do it the first time through the change callback.

For lookups the most complete lookup is to use RangeVarGetRelid() to get
the oid. There's other variants, but that's the easiest approach.

Do you have to care about the table being renamed?

Greetings,

Andres Freund


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

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: [GENERAL] Index size
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: [GENERAL] huge table occupation after updates