Generated Record
The PostgreSQL CDC Client generates a single record from each transaction. Since each transaction can include multiple CRUD operations, the PostgreSQL CDC Client origin can also include multiple operations in a record.
As a result, the origin does not write the CRUD
operations to the sdc.operation.type
record header
attribute. Depending on your use case, you might use a scripting processor
to convert the records as needed. Or, you might use a Field Pivoter and
other processors to separate the data to create a record for each
operation.
PostgreSQL CDC Client origin records include the following fields:
Field Name | Description |
---|---|
xid | Transaction ID. |
nextlsn | Next Logical Sequence Number (LSN). |
timestamp | Timestamp with sub-second granularity, including the time zone offset from UTC. |
change | A list field that includes the following details about each data change:
|
Sample Record
{
"xid": 598,
"nextlsn": "0/16751E8",
"timestamp": "2018-07-13 13:24:44.152109-07",
"change": [
{
"kind": "update",
"schema": "public",
"table": "table1",
"columnnames": [
"id",
"value"
],
"columntypes": [
"integer",
"character(33)"
],
"columnvalues": [
1,
"a"
],
"oldkeys": {
"keynames": [
"value"
],
"keytypes": [
"character(33)"
],
"keyvalues": [
"a"
]
}
},
{
"kind": "update",
"schema": "public",
"table": "table1",
"columnnames": [
"id",
"value"
],
"columntypes": [
"integer",
"character(33)"
],
"columnvalues": [
2,
"b "
],
"oldkeys": {
"keynames": [
"value"
],
"keytypes": [
"character(33)"
],
"keyvalues": [
"b "
]
}
},
{
"kind": "update",
"schema": "public",
"table": "table1",
"columnnames": [
"id",
"value"
],
"columntypes": [
"integer",
"character(33)"
],
"columnvalues": [
3,
"c "
],
"oldkeys": {
"keynames": [
"value"
],
"keytypes": [
"character(33)"
],
"keyvalues": [
"c "
]
}
},
{
"kind": "update",
"schema": "public",
"table": "table2",
"columnnames": [
"id",
"name"
],
"columntypes": [
"integer",
"character varying(255)"
],
"columnvalues": [
1,
"a"
],
"oldkeys": {
"keynames": [
"id"
],
"keytypes": [
"integer"
],
"keyvalues": [
1
]
}
},
{
"kind": "update",
"schema": "public",
"table": "table2",
"columnnames": [
"id",
"name"
],
"columntypes": [
"integer",
"character varying(255)"
],
"columnvalues": [
2,
"b"
],
"oldkeys": {
"keynames": [
"id"
],
"keytypes": [
"integer"
],
"keyvalues": [
2
]
}
},
{
"kind": "update",
"schema": "public",
"table": "table2",
"columnnames": [
"id",
"name"
],
"columntypes": [
"integer",
"character varying(255)"
],
"columnvalues": [
3,
"c"
],
"oldkeys": {
"keynames": [
"id"
],
"keytypes": [
"integer"
],
"keyvalues": [
3
]
}
}
]
}