Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkqmV-0005ZK-NE for pgsql-general@arkaria.postgresql.org; Wed, 10 Nov 2021 16:49:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mkqmT-0002pI-I0 for pgsql-general@arkaria.postgresql.org; Wed, 10 Nov 2021 16:49:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkqmT-0002p9-6f for pgsql-general@lists.postgresql.org; Wed, 10 Nov 2021 16:49:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mkqmM-0006he-Lt for pgsql-general@lists.postgresql.org; Wed, 10 Nov 2021 16:49:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1AAGmq9H1444796; Wed, 10 Nov 2021 11:48:52 -0500 From: Tom Lane To: Stefen Hillman cc: pgsql-general@lists.postgresql.org Subject: Re: Logical Replication - Type messages? In-reply-to: References: Comments: In-reply-to Stefen Hillman message dated "Mon, 08 Nov 2021 11:16:57 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1444794.1636562932.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Nov 2021 11:48:52 -0500 Message-ID: <1444795.1636562932@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Stefen Hillman 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 o= ne 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