pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stefen Hillman <stefen.hillman@fivetran.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Logical Replication - Type messages?
Date: Wed, 10 Nov 2021 11:48:52 -0500
Message-ID: <1444795.1636562932@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPgW8pMknK5pup6=T4a_UG=Cz80Rgp=KONqJmTdHfaZb0RvnFg@mail.gmail.com>
References: <CAPgW8pMknK5pup6=T4a_UG=Cz80Rgp=KONqJmTdHfaZb0RvnFg@mail.gmail.com>

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





view thread (2+ messages)

Message-ID: <1444795.1636562932@sss.pgh.pa.us>
Permalink:  ../1444795.1636562932@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1444795.1636562932@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stefen.hillman@fivetran.com
  Subject: Re: Logical Replication - Type messages?
  In-Reply-To: <1444795.1636562932@sss.pgh.pa.us>
  References: <CAPgW8pMknK5pup6=T4a_UG=Cz80Rgp=KONqJmTdHfaZb0RvnFg@mail.gmail.com> <1444795.1636562932@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox