{"Entry":{"collection":"protocol","key":"logical-delete","name":"Delete (logical replication)","aliases":["Delete"],"metadata":{"aliases":["Delete"],"category":"Logical replication formats","content_hash":"93c48c38494162e37b779dfe94a68df9fb96acae78725728f64dc455b4624fcd","imported_at":"2026-09-30T00:40:44.618632+08:00","name":"Delete (logical replication)","name_zh":"","slug":"logical-delete","summary":"Logical replication Delete format. Identifies the message as a delete message."}},"Definition":{"Collection":"protocol","Key":"logical-delete","SourceDatabase":"center","Version":"18","SourceTable":"protocol_message","SourceKey":"logical-delete","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"comparison_data":{"fields":[{"description":"Identifies the message as a delete message.","format":"Byte1('D')"},{"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 corresponding to the ID in the relation message.","format":"Int32 (Oid)"},{"description":"Identifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY.","format":"Byte1('K')"},{"description":"Identifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL.","format":"Byte1('O')"},{"description":"TupleData message part representing the contents of the old tuple or primary key, depending on the previous field.","format":"TupleData"}],"layer":"logical replication"},"comparison_hash":"9022c0a1dbfe8824c1c59e3f8148a057e31c9d3edb2919fc83764704f181462c","description":["Logical replication Delete format. Identifies the message as a delete message."],"facts":[{"label":"Layer","value":"Logical replication payload; distinct from the frontend/backend message envelope"},{"label":"First field","value":"Byte1('D')"}],"fields":[{"description":"Identifies the message as a delete message.","format":"Byte1('D')"},{"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 corresponding to the ID in the relation message.","format":"Int32 (Oid)"},{"description":"Identifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY.","format":"Byte1('K')"},{"description":"Identifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL.","format":"Byte1('O')"},{"description":"TupleData message part representing the contents of the old tuple or primary key, depending on the previous field.","format":"TupleData"}],"manual_html":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('D')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a delete 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 corresponding to the ID in the relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('K')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('O')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eTupleData\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTupleData message part representing the contents of the old tuple or primary key, depending on the previous field.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe Delete message may contain either a 'K' message part or an 'O' message part, but never both of them.\u003c/p\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":"Delete","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-DELETE"}],"tables":[{"columns":[{"key":"c0","label":"Position"},{"key":"c1","label":"Format"},{"key":"c2","label":"Meaning"}],"key":"fields","rows":[{"c0":"1","c1":"Byte1('D')","c2":"Identifies the message as a delete 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 corresponding to the ID in the relation message."},{"c0":"4","c1":"Byte1('K')","c2":"Identifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY."},{"c0":"5","c1":"Byte1('O')","c2":"Identifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL."},{"c0":"6","c1":"TupleData","c2":"TupleData message part representing the contents of the old tuple or primary key, depending on the previous field."}],"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-DELETE"}]},"MeasuredEvidence":{}},"Text":{"Collection":"protocol","Key":"logical-delete","SourceDatabase":"center","Version":"18","Locale":"en","Title":"Delete (logical replication)","Summary":"Logical replication Delete format. Identifies the message as a delete message.","BodyHTML":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003eByte1(\u0026#39;D\u0026#39;)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a delete 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 corresponding to the ID in the relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eByte1(\u0026#39;K\u0026#39;)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eByte1(\u0026#39;O\u0026#39;)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003eTupleData\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTupleData message part representing the contents of the old tuple or primary key, depending on the previous field.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe Delete message may contain either a \u0026#39;K\u0026#39; message part or an \u0026#39;O\u0026#39; message part, but never both of them.\u003c/p\u003e\n\u003c/dd\u003e\u003c/dl\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"8fe2e24507bb0e69af6cdcb774b4d3850c4bba785d3bdb623bb2b513dbafbc5f","Payload":{"description":["Logical replication Delete format. Identifies the message as a delete message."],"manual_html":"\u003cdl\u003e\u003cdd\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('D')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the message as a delete 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 corresponding to the ID in the relation message.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('K')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eByte1('O')\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIdentifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003eTupleData\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eTupleData message part representing the contents of the old tuple or primary key, depending on the previous field.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe Delete message may contain either a 'K' message part or an 'O' message part, but never both of them.\u003c/p\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('D')","c2":"Identifies the message as a delete 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 corresponding to the ID in the relation message."},{"c0":"4","c1":"Byte1('K')","c2":"Identifies the following TupleData submessage as a key. This field is present if the table in which the delete has happened uses an index as REPLICA IDENTITY."},{"c0":"5","c1":"Byte1('O')","c2":"Identifies the following TupleData message as an old tuple. This field is present if the table in which the delete happened has REPLICA IDENTITY set to FULL."},{"c0":"6","c1":"TupleData","c2":"TupleData message part representing the contents of the old tuple or primary key, depending on the previous field."}],"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}
