Skip to content

Commit

Permalink
pgwire: test \u0001 in JSON pgwire encoding
Browse files Browse the repository at this point in the history
Verify that we handle "\u0001" JSON strings identically to postgres. The
printing of \u0001 instead of some other character is correct, and the
same as what postgres does. (We do not test \u0000 here because postgres
rejects it as a valid string, even though we accept it.)

Closes #33165

Release note: None
  • Loading branch information
maddyblue committed Dec 18, 2018
1 parent fa7084f commit 6af01b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cmd/generate-binary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ var inputs = map[string][]string{
`false`,
`null`,
`[[[[true, false, null]]]]`,
`["\u0001", "\u0041", "\u26a3", "\ud83e\udd37"]`,
},

"'%s'::uuid[]": {
Expand Down
6 changes: 6 additions & 0 deletions pkg/sql/pgwire/testdata/encodings.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,12 @@
"TextAsBinary": [91, 91, 91, 91, 116, 114, 117, 101, 44, 32, 102, 97, 108, 115, 101, 44, 32, 110, 117, 108, 108, 93, 93, 93, 93],
"Binary": [1, 91, 91, 91, 91, 116, 114, 117, 101, 44, 32, 102, 97, 108, 115, 101, 44, 32, 110, 117, 108, 108, 93, 93, 93, 93]
},
{
"SQL": "'[\"\\u0001\", \"\\u0041\", \"\\u26a3\", \"\\ud83e\\udd37\"]'::jsonb",
"Text": "[\"\\u0001\", \"A\", \"\", \"🤷\"]",
"TextAsBinary": [91, 34, 92, 117, 48, 48, 48, 49, 34, 44, 32, 34, 65, 34, 44, 32, 34, 226, 154, 163, 34, 44, 32, 34, 240, 159, 164, 183, 34, 93],
"Binary": [1, 91, 34, 92, 117, 48, 48, 48, 49, 34, 44, 32, 34, 65, 34, 44, 32, 34, 226, 154, 163, 34, 44, 32, 34, 240, 159, 164, 183, 34, 93]
},
{
"SQL": "'00:00:00'::time",
"Text": "00:00:00",
Expand Down

0 comments on commit 6af01b9

Please sign in to comment.