{"Entry":{"collection":"protocol","key":"logical-relation","name":"Relation (logical replication)","aliases":["Relation"],"metadata":{"aliases":["Relation"],"category":"Logical replication formats","content_hash":"8de3e5c48a9047bf2cfc3c66cacd64afd0aa27b55de8dcce20975dd6f50ebfec","imported_at":"2026-09-30T00:40:44.638614+08:00","name":"Relation (logical replication)","name_zh":"","slug":"logical-relation","summary":"Logical replication Relation format. Identifies the message as a relation message."}},"Definition":{"Collection":"protocol","Key":"logical-relation","SourceDatabase":"center","Version":"18","SourceTable":"protocol_message","SourceKey":"logical-relation","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"fields":[{"description":"Identifies the message as a relation message.","format":"Byte1('R')"},{"description":"Xid of the transaction (only present for streamed transactions). This field is available since protocol version 2.","format":"Int32 (TransactionId)"},{"description":"OID of the relation.","format":"Int32 (Oid)"},{"description":"Namespace (empty string for pg_catalog ).","format":"String"},{"description":"Relation name.","format":"String"},{"description":"Replica identity setting for the relation (same as relreplident in pg_class ).","format":"Int8"},{"description":"Number of columns.","format":"Int16"},{"description":"Flags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.","format":"Int8"},{"description":"Name of the column.","format":"String"},{"description":"OID of the column's data type.","format":"Int32 (Oid)"},{"description":"Type modifier of the column ( atttypmod ).","format":"Int32"}],"layer":"logical replication"},"comparison_hash":"e38e342bd63afe84c580ef245a7f6c70b95b32928e766a86e51f9732fd2569b4","description":["Logical replication Relation format. Identifies the message as a relation message."],"facts":[{"label":"Layer","value":"Logical replication payload; distinct from the frontend/backend message envelope"},{"label":"First field","value":"Byte1('R')"}],"fields":[{"description":"Identifies the message as a relation message.","format":"Byte1('R')"},{"description":"Xid of the transaction (only present for streamed transactions). This field is available since protocol version 2.","format":"Int32 (TransactionId)"},{"description":"OID of the relation.","format":"Int32 (Oid)"},{"description":"Namespace (empty string for pg_catalog ).","format":"String"},{"description":"Relation name.","format":"String"},{"description":"Replica identity setting for the relation (same as relreplident in pg_class ).","format":"Int8"},{"description":"Number of columns.","format":"Int16"},{"description":"Flags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.","format":"Int8"},{"description":"Name of the column.","format":"String"},{"description":"OID of the column's data type.","format":"Int32 (Oid)"},{"description":"Type modifier of the column ( atttypmod ).","format":"Int32"}],"manual_html":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('R')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (TransactionId)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eXid of the transaction (only present for streamed transactions). This field is available since protocol version 2.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNamespace (empty string for \u003ccode class=\"literal\"\u003epg_catalog\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRelation name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReplica identity setting for the relation (same as \u003ccode class=\"structfield\"\u003erelreplident\u003c/code\u003e in \u003ccode class=\"structname\"\u003epg_class\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt16\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNumber of columns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNext, the following message part appears for each column included in the publication:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eFlags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eName of the column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the column's data type.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eType modifier of the column (\u003ccode class=\"structfield\"\u003eatttypmod\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\u003c/dl\u003e","manual_path":"/docs/18/protocol-logicalrep-message-formats.html","related":[{"label":"Streaming replication protocol","url":"/docs/18/protocol-replication.html"},{"label":"Logical Decoding Plugins","url":"/wiki/decode/?v=18"}],"release":{"channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[{"paragraphs":["This section describes the detailed format of each logical replication message. These messages are either returned by the replication slot SQL interface or are sent by a walsender. In the case of a walsender, they are encapsulated inside replication protocol WAL messages as described in Section 54.4 , and generally obey the same message flow as physical replication. The following messages (Stream Start, Stream Stop, Stream Commit, and Stream Abort) are available since protocol version 2. The following messages (Begin Prepare, Prepare, Commit Prepared, Rollback Prepared, Stream Prepare) are available since protocol version 3. The following message parts are shared by the above messages."],"title":"Protocol context"}],"signature":"Relation","sources":[{"label":"PostgreSQL 18 English manual","path":"protocol-logicalrep-message-formats.html","sha256":"e976b008206820fbeb1eba226e69bb7c00af157372c3545375d1b5053c76d0ad","url":"/docs/18/protocol-logicalrep-message-formats.html#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-RELATION"}],"tables":[{"columns":[{"key":"c0","label":"Position"},{"key":"c1","label":"Format"},{"key":"c2","label":"Meaning"}],"key":"fields","rows":[{"c0":"1","c1":"Byte1('R')","c2":"Identifies the message as a relation message."},{"c0":"2","c1":"Int32 (TransactionId)","c2":"Xid of the transaction (only present for streamed transactions). This field is available since protocol version 2."},{"c0":"3","c1":"Int32 (Oid)","c2":"OID of the relation."},{"c0":"4","c1":"String","c2":"Namespace (empty string for pg_catalog )."},{"c0":"5","c1":"String","c2":"Relation name."},{"c0":"6","c1":"Int8","c2":"Replica identity setting for the relation (same as relreplident in pg_class )."},{"c0":"7","c1":"Int16","c2":"Number of columns."},{"c0":"8","c1":"Int8","c2":"Flags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key."},{"c0":"9","c1":"String","c2":"Name of the column."},{"c0":"10","c1":"Int32 (Oid)","c2":"OID of the column's data type."},{"c0":"11","c1":"Int32","c2":"Type modifier of the column ( atttypmod )."}],"title":"Fields in documented order"}]},"ManualEvidence":{"manual_path":"/docs/18/protocol-logicalrep-message-formats.html","release":{"channel":"stable","label":"18.6","major":"18","ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"label":"PostgreSQL 18 English manual","path":"protocol-logicalrep-message-formats.html","sha256":"e976b008206820fbeb1eba226e69bb7c00af157372c3545375d1b5053c76d0ad","url":"/docs/18/protocol-logicalrep-message-formats.html#PROTOCOL-LOGICALREP-MESSAGE-FORMATS-RELATION"}]},"MeasuredEvidence":{}},"Text":{"Collection":"protocol","Key":"logical-relation","SourceDatabase":"center","Version":"18","Locale":"en","Title":"Relation (logical replication)","Summary":"Logical replication Relation format. Identifies the message as a relation message.","BodyHTML":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003eByte1(\u0026#39;R\u0026#39;)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt32 (TransactionId)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eXid of the transaction (only present for streamed transactions). This field is available since protocol version 2.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNamespace (empty string for \u003ccode\u003epg_catalog\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRelation name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReplica identity setting for the relation (same as \u003ccode\u003erelreplident\u003c/code\u003e in \u003ccode\u003epg_class\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt16\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNumber of columns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNext, the following message part appears for each column included in the publication:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eFlags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eName of the column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the column\u0026#39;s data type.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eInt32\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eType modifier of the column (\u003ccode\u003eatttypmod\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\u003c/dl\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"a456dea01de63d22d1688ffb9f57465ed9e0671afb1be5dce9945fdf5b1fe5e8","Payload":{"description":["Logical replication Relation format. Identifies the message as a relation message."],"manual_html":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('R')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (TransactionId)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eXid of the transaction (only present for streamed transactions). This field is available since protocol version 2.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the relation.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNamespace (empty string for \u003ccode class=\"literal\"\u003epg_catalog\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eRelation name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eReplica identity setting for the relation (same as \u003ccode class=\"structfield\"\u003erelreplident\u003c/code\u003e in \u003ccode class=\"structname\"\u003epg_class\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt16\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNumber of columns.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNext, the following message part appears for each column included in the publication:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt8\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eFlags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eString\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eName of the column.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32 (Oid)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eOID of the column's data type.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eInt32\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eType modifier of the column (\u003ccode class=\"structfield\"\u003eatttypmod\u003c/code\u003e).\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/dd\u003e\u003c/dl\u003e","related":[{"label":"Streaming replication protocol","url":"/docs/18/protocol-replication.html"},{"label":"Logical Decoding Plugins","url":"/wiki/decode/?v=18"}],"sections":[{"paragraphs":["This section describes the detailed format of each logical replication message. These messages are either returned by the replication slot SQL interface or are sent by a walsender. In the case of a walsender, they are encapsulated inside replication protocol WAL messages as described in Section 54.4 , and generally obey the same message flow as physical replication. The following messages (Stream Start, Stream Stop, Stream Commit, and Stream Abort) are available since protocol version 2. The following messages (Begin Prepare, Prepare, Commit Prepared, Rollback Prepared, Stream Prepare) are available since protocol version 3. The following message parts are shared by the above messages."],"title":"Protocol context"}],"tables":[{"columns":[{"key":"c0","label":"Position"},{"key":"c1","label":"Format"},{"key":"c2","label":"Meaning"}],"key":"fields","rows":[{"c0":"1","c1":"Byte1('R')","c2":"Identifies the message as a relation message."},{"c0":"2","c1":"Int32 (TransactionId)","c2":"Xid of the transaction (only present for streamed transactions). This field is available since protocol version 2."},{"c0":"3","c1":"Int32 (Oid)","c2":"OID of the relation."},{"c0":"4","c1":"String","c2":"Namespace (empty string for pg_catalog )."},{"c0":"5","c1":"String","c2":"Relation name."},{"c0":"6","c1":"Int8","c2":"Replica identity setting for the relation (same as relreplident in pg_class )."},{"c0":"7","c1":"Int16","c2":"Number of columns."},{"c0":"8","c1":"Int8","c2":"Flags for the column. Currently can be either 0 for no flags or 1 which marks the column as part of the key."},{"c0":"9","c1":"String","c2":"Name of the column."},{"c0":"10","c1":"Int32 (Oid)","c2":"OID of the column's data type."},{"c0":"11","c1":"Int32","c2":"Type modifier of the column ( atttypmod )."}],"title":"Fields in documented order"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
