forked from MaterializeInc/materialize
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
237 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Test status codes for the chr function | ||
|
||
# NOTE: Postgres does not send the RowDescription messages for these queries, | ||
# while we do. This is why we ignore all RowDescription messages. | ||
|
||
# NullCharacterNotPermitted maps to 54000 | ||
send | ||
Query {"query": "SELECT chr(0)"} | ||
---- | ||
|
||
until ignore=RowDescription | ||
ReadyForQuery | ||
---- | ||
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"54000"},{"typ":"M","value":"null character not permitted"}]} | ||
ReadyForQuery {"status":"I"} | ||
|
||
|
||
# CharacterNotValidForEncoding maps to 54000 | ||
send | ||
Query {"query": "SELECT chr(55296)"} | ||
---- | ||
|
||
until ignore=RowDescription | ||
ReadyForQuery | ||
---- | ||
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"54000"},{"typ":"M","value":"requested character not valid for encoding: 55296"}]} | ||
ReadyForQuery {"status":"I"} | ||
|
||
|
||
# CharacterTooLargeForEncoding maps to 54000 | ||
send | ||
Query {"query": "SELECT chr(1114112)"} | ||
---- | ||
|
||
until ignore=RowDescription | ||
ReadyForQuery | ||
---- | ||
ErrorResponse {"fields":[{"typ":"S","value":"ERROR"},{"typ":"C","value":"54000"},{"typ":"M","value":"requested character too large for encoding: 1114112"}]} | ||
ReadyForQuery {"status":"I"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Copyright Materialize, Inc. and contributors. All rights reserved. | ||
# | ||
# Use of this software is governed by the Business Source License | ||
# included in the LICENSE file at the root of this repository. | ||
# | ||
# As of the Change Date specified in that file, in accordance with | ||
# the Business Source License, use of this software will be governed | ||
# by the Apache License, Version 2.0. | ||
|
||
# Return NULL for NULL input | ||
query T | ||
SELECT chr(NULL) | ||
---- | ||
NULL | ||
|
||
query error null character not permitted | ||
SELECT chr(0) | ||
|
||
# Match behavior of Postgres 14 | ||
query error requested character too large for encoding: -1 | ||
SELECT chr(-1) | ||
|
||
# i32.MIN | ||
query error requested character too large for encoding: -2147483648 | ||
SELECT chr(-2147483648) | ||
|
||
# Test non-printable characters | ||
query T | ||
SELECT chr(1) = E'\u0001' | ||
---- | ||
true | ||
|
||
query T | ||
SELECT chr(2) = E'\u0002' | ||
---- | ||
true | ||
|
||
query T | ||
SELECT chr(10) = E'\u000a' | ||
---- | ||
true | ||
|
||
query T | ||
SELECT chr(126) | ||
---- | ||
~ | ||
|
||
query T | ||
SELECT chr(127) = E'\u007f' | ||
---- | ||
true | ||
|
||
# Check if non-ASCII characters work | ||
query T | ||
SELECT chr(128) = E'\u0080' | ||
---- | ||
true | ||
|
||
# Test random basic multilingual plane (BMP) character | ||
query T | ||
SELECT chr(9233) | ||
---- | ||
␑ | ||
|
||
# Last code point before the surrogates | ||
query T | ||
SELECT chr(55295) | ||
---- | ||
| ||
|
||
# Surrogate characters should not be encoded in UTF-8 | ||
# 55296 = U+D800 | ||
query error requested character not valid for encoding: 55296 | ||
SELECT chr(55296) | ||
|
||
# Last surrogate character | ||
# 57343 = U+DFFF | ||
query error requested character not valid for encoding: 57343 | ||
SELECT chr(57343) | ||
|
||
query T | ||
SELECT chr(57344) | ||
---- | ||
| ||
|
||
# Test full and half width characters | ||
query T | ||
SELECT chr(65318) | ||
---- | ||
F | ||
|
||
query T | ||
SELECT chr(65383) | ||
---- | ||
ァ | ||
|
||
# Test supplementary multilingual plane (SMP / Plane 1) characters | ||
query T | ||
SELECT chr(66312) | ||
---- | ||
𐌈 | ||
|
||
query T | ||
SELECT chr(92330) | ||
---- | ||
𖢪 | ||
|
||
query T | ||
SELECT chr(128579) | ||
---- | ||
🙃 | ||
|
||
# Test composing regional indicator symbols | ||
query T | ||
SELECT chr(127463) || chr(127479); | ||
---- | ||
🇧🇷 | ||
|
||
# Test supplementary ideographic plane (SIP / Plane 2) characters | ||
query T | ||
SELECT chr(194564) | ||
---- | ||
你 | ||
|
||
# Test last valid Unicode code point | ||
query T | ||
SELECT chr(1114111) = E'\U0010FFFF' | ||
---- | ||
true | ||
|
||
# First invalid code point | ||
query error requested character too large for encoding: 1114112 | ||
SELECT chr(1114112) | ||
|
||
# i32.MAX | ||
query error requested character too large for encoding: 2147483647 | ||
SELECT chr(2147483647) |