From 9e83c45a056b3dc3477b9ff9fb946ab62f51747e Mon Sep 17 00:00:00 2001 From: Connor Finnell Date: Tue, 2 Jul 2024 11:26:32 -0600 Subject: [PATCH] test: Demonstrate difference with backspace character Postgres will honor the '\b' input for backspace characters, but cockroach will convert it to the unicode equivalent of '\u0008'. --- integration_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_test.go b/integration_test.go index 22bf83cc..2d122e3e 100644 --- a/integration_test.go +++ b/integration_test.go @@ -202,12 +202,12 @@ func TestVerifyData(t *testing.T) { "numeric": {"0", "123.456", "-123.456"}, "decimal": {"0", "123.456", "-123.456"}, - "text": {`'foo'`, `'bar'`, `''`, `'something that is much longer but without much other complication'`}, + "text": {`'foo'`, `'bar'`, `''`, `'something that is much longer but without much other complication'`, `'contains \b backspace character'`}, "uuid": {fmt.Sprintf("'%s'", uuid.New().String())}, - `character varying(64)`: {`'more string stuff'`}, + `character varying(64)`: {`'more string stuff'`, `'string with \b backspace character'`}, - "jsonb": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`}, - "json": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`}, + "jsonb": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar with \b backspace"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`}, + "json": {`'{}'`, `'{"foo": ["bar", "baz"]}'`, `'{"foo": "bar with \b backspace"}'`, `'{"foo": "bar", "baz": "qux"}'`, `'{"for sure?": true, "has numbers": 123.456, "this is": ["some", "json", "blob"]}'`}, "date": {`'2020-12-31'`}, "timestamp with time zone": {`'2020-12-31 23:59:59 -8:00'`, `'2022-06-08 20:03:06.957223+00'`}, // hashes differently for psql/crdb, convert to epoch when hashing