Skip to content

With CHAR(8) primary key trailing whitespace is present in changes_only messages #4039

@tjenkinson

Description

@tjenkinson

Versions

  • Client: plain HTTP
  • Electric: 1.4.15

Bug description

  1. Create a table with id column that is CHAR(8)
  2. get electric running and start a shape
  3. insert a record with id b
  4. make a changes only request /v1/shape?table=todos&log=changes_only&offset={offset}&handle={handle}
  5. make a full request /v1/shape?table=todos&log=full&offset=-1
  6. make a subset request /v1/shape?table=todos&log=changes_only&offset=-1&handle={handle}&subset__where=true

Expected behaviour
The keys in the change messages should not have trailing whitespace and match the full and subset ones

Also boolean columns are represented the same everywhere.

Actual behaviour

  • Change message has the trailing spaces. Full and subset ones don't.
  • Change message has booleans as "t" and "f". Full and subset ones have them as "true" and "false"

Changes_only response:

[
	{
		"value": {
			"completed": "t",
			"createdAt": "2026-03-21 21:10:18.767885+00",
			"id": "b       ",
			"title": "test"
		},
		"key": "\"public\".\"todos\"/\"b       \"",
		"headers": {
			"last": true,
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert",
			"lsn": "27370056",
			"op_position": 0,
			"txids": [
				797
			]
		}
	},
	{
		"headers": {
			"control": "up-to-date",
			"global_last_seen_lsn": "27370056"
		}
	}
]

Full response:

[
	{
		"key": "\"public\".\"todos\"/\"2\"",
		"value": {
			"completed": "false",
			"createdAt": "2026-03-19 21:36:42.548193+00",
			"id": "2",
			"title": "a"
		},
		"headers": {
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert"
		}
	},
	{
		"key": "\"public\".\"todos\"/\"abc\"",
		"value": {
			"completed": "false",
			"createdAt": "2026-03-19 21:30:40.305579+00",
			"id": "abc",
			"title": "testttt"
		},
		"headers": {
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert"
		}
	},
	{
		"key": "\"public\".\"todos\"/\"1\"",
		"value": {
			"completed": "false",
			"createdAt": "2026-03-19 21:34:01.416321+00",
			"id": "1",
			"title": "updated"
		},
		"headers": {
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert"
		}
	},
	{
		"key": "\"public\".\"todos\"/\"a\"",
		"value": {
			"completed": "false",
			"createdAt": "2026-03-21 21:08:03.491479+00",
			"id": "a",
			"title": "test"
		},
		"headers": {
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert"
		}
	},
	{
		"key": "\"public\".\"todos\"/\"b\"",
		"value": {
			"completed": "true",
			"createdAt": "2026-03-21 21:10:18.767885+00",
			"id": "b",
			"title": "test"
		},
		"headers": {
			"relation": [
				"public",
				"todos"
			],
			"operation": "insert"
		}
	},
	{
		"headers": {
			"control": "snapshot-end",
			"xmin": "798",
			"xmax": "798",
			"xip_list": []
		}
	}
]

Subset response:

{
	"metadata": {
		"xmin": "798",
		"xmax": "798",
		"xip_list": [],
		"database_lsn": "27370392",
		"snapshot_mark": 1039688366
	},
	"data": [
		{
			"key": "\"public\".\"todos\"/\"2\"",
			"value": {
				"completed": "false",
				"createdAt": "2026-03-19 21:36:42.548193+00",
				"id": "2",
				"title": "a"
			},
			"headers": {
				"relation": [
					"public",
					"todos"
				],
				"operation": "insert",
				"snapshot_mark": 1039688366
			}
		},
		{
			"key": "\"public\".\"todos\"/\"abc\"",
			"value": {
				"completed": "false",
				"createdAt": "2026-03-19 21:30:40.305579+00",
				"id": "abc",
				"title": "testttt"
			},
			"headers": {
				"relation": [
					"public",
					"todos"
				],
				"operation": "insert",
				"snapshot_mark": 1039688366
			}
		},
		{
			"key": "\"public\".\"todos\"/\"1\"",
			"value": {
				"completed": "false",
				"createdAt": "2026-03-19 21:34:01.416321+00",
				"id": "1",
				"title": "updated"
			},
			"headers": {
				"relation": [
					"public",
					"todos"
				],
				"operation": "insert",
				"snapshot_mark": 1039688366
			}
		},
		{
			"key": "\"public\".\"todos\"/\"a\"",
			"value": {
				"completed": "false",
				"createdAt": "2026-03-21 21:08:03.491479+00",
				"id": "a",
				"title": "test"
			},
			"headers": {
				"relation": [
					"public",
					"todos"
				],
				"operation": "insert",
				"snapshot_mark": 1039688366
			}
		},
		{
			"key": "\"public\".\"todos\"/\"b\"",
			"value": {
				"completed": "true",
				"createdAt": "2026-03-21 21:10:18.767885+00",
				"id": "b",
				"title": "test"
			},
			"headers": {
				"relation": [
					"public",
					"todos"
				],
				"operation": "insert",
				"snapshot_mark": 1039688366
			}
		}
	]
}

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions