Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit74da4c7

Browse files
committed
Doc: improve protocol spec for logical replication Type messages.
protocol.sgml documented the layout for Type messages, but completelydropped the ball otherwise, failing to explain what they are, whenthey are sent, or what they're good for. While at it, do a littlecopy-editing on the description of Relation messages.In passing, adjust the comment for apply_handle_type() to make itclearer that we choose not to do anything when receiving a Typemessage, not that we think it has no use whatsoever.Per question from Stefen Hillman.Discussion:https://postgr.es/m/CAPgW8pMknK5pup6=T4a_UG=Cz80Rgp=KONqJmTdHfaZb0RvnFg@mail.gmail.com
1 parent3aa858c commit74da4c7

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

‎doc/src/sgml/protocol.sgml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,13 +2903,25 @@ The commands accepted in replication mode are:
29032903
</para>
29042904

29052905
<para>
2906-
Every DML message contains an arbitrary relation ID, which can be mapped to
2907-
an ID in the Relation messages. The Relation messages describe the schema of the
2908-
given relation. The Relation message is sent for a given relation either
2909-
because it is the first time we send a DML message for given relation in the
2910-
current session or because the relation definition has changed since the
2911-
last Relation message was sent for it. The protocol assumes that the client
2912-
is capable of caching the metadata for as many relations as needed.
2906+
Every DML message contains a relation OID, identifying the publisher's
2907+
relation that was acted on. Before the first DML message for a given
2908+
relation OID, a Relation message will be sent, describing the schema of
2909+
that relation. Subsequently, a new Relation message will be sent if
2910+
the relation's definition has changed since the last Relation message
2911+
was sent for it. (The protocol assumes that the client is capable of
2912+
remembering this metadata for as many relations as needed.)
2913+
</para>
2914+
2915+
<para>
2916+
Relation messages identify column types by their OIDs. In the case
2917+
of a built-in type, it is assumed that the client can look up that
2918+
type OID locally, so no additional data is needed. For a non-built-in
2919+
type OID, a Type message will be sent before the Relation message,
2920+
to provide the type name associated with that OID. Thus, a client that
2921+
needs to specifically identify the types of relation columns should
2922+
cache the contents of Type messages, and first consult that cache to
2923+
see if the type OID is defined there. If not, look up the type OID
2924+
locally.
29132925
</para>
29142926
</sect2>
29152927
</sect1>

‎src/backend/replication/logical/worker.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,10 @@ apply_handle_relation(StringInfo s)
11961196
/*
11971197
* Handle TYPE message.
11981198
*
1199-
* This is now vestigial; we read the info and discard it.
1199+
* This implementation pays no attention to TYPE messages; we expect the user
1200+
* to have set things up so that the incoming data is acceptable to the input
1201+
* functions for the locally subscribed tables. Hence, we just read and
1202+
* discard the message.
12001203
*/
12011204
staticvoid
12021205
apply_handle_type(StringInfos)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp