Re: Logical Replication - Type messages?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Logical Replication - Type messages?
Дата
Msg-id 1444795.1636562932@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Logical Replication - Type messages?  (Stefen Hillman <stefen.hillman@fivetran.com>)
Список pgsql-general
Stefen Hillman <stefen.hillman@fivetran.com> writes:
> Currently, I process Relation messages to get most of the information I
> need to work with Inserts, Updates, and Deletes. However, for type
> information I'm currently using a SQL query to get the column type
> information. I wanted to use the Type messages, but I never see them. I see
> Begin, Commit, etc. but never Type.

>    - When are the Type messages generated and sent by the server?
>    - Is there a way to cause them to be generated?

Hmm.  AFAICS the Type messages are completely undocumented in
protocol.sgml, which is an oversight.  Looking at the code, they
do exist, but they are sent only when a Relation message refers
to a non-built-in type.  There's a presumption that built-in
types have stable OIDs that will be the same at publisher and
subscriber, so the replication traffic needn't tell the subscriber
what those OIDs mean.  Non-built-in types don't have stable OIDs,
so we want to tell the subscriber what those OIDs mean.

(Actually, it looks like the cutoff is FirstGenbkiObjectId, which
means that the Type message is only suppressed for hand-assigned
type OIDs, an even stricter rule than "built in".  So for testing
purposes you could try something like an array type; replicating
a table with an array column should give rise to Type messages.)

>    - Are these type id > type mappings set in stone, or does PostgreSQL
>    allow for a server to have custom types (I notice that namespace is one of
>    the properties sent with the types)?

Some would say that custom types are THE defining feature of
Postgres, compared to other SQL implementations.

            regards, tom lane



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: E.1.2. Migration to Version 14
Следующее
От: Дмитрий Иванов
Дата:
Сообщение: Re: E.1.2. Migration to Version 14