-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{171428666}: column character encoding
A new `ENCODING` keyword is introduced in this patch, that specifies a character set for a column. Invalid character encoding will be rejected. So far only `"utf8"` and `NONE` are supported. This allows users to conveniently create an indexable utf8 cstring column. It's implemented as a check constraint using the `utf8_validate()` function. Signed-off-by: Rivers Zhang <[email protected]>
- Loading branch information
1 parent
2dc04c8
commit 90b6440
Showing
17 changed files
with
182 additions
and
21 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,17 @@ | ||
[CREATE TABLE t15(a INTEGER ENCODING 'ascii')] failed with rc -3 unknown charset | ||
[CREATE TABLE t15(a INTEGER ENCODING 'utf8')] failed with rc -3 invalid column type to use character encoding | ||
[CREATE TABLE t15(a TEXT ENCODING 'utf8')] failed with rc -3 invalid column type to use character encoding | ||
(csc2='schema | ||
{ | ||
cstring a[11] null = yes | ||
} | ||
constraints | ||
{ | ||
check "$CONSTRAINT_CHAR_ENC_a" = {where utf8_validate(a)=0} | ||
} | ||
') | ||
[INSERT INTO t15 VALUES (CAST(x'616263FF616263' AS TEXT))] failed with rc 403 CHECK constraint violation CHECK constraint failed for '$CONSTRAINT_CHAR_ENC_a' unable to add record rc = 320 | ||
(COUNT(*)=0) | ||
(rows inserted=1) | ||
(COUNT(*)=1) | ||
[ALTER TABLE t15 ALTER COLUMN a ENCODING 'utf8'] failed with rc 240 Record violates check constraints rrn xx genid xx |
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,13 @@ | ||
DROP TABLE IF EXISTS t15 | ||
CREATE TABLE t15(a INTEGER ENCODING 'ascii')$$ | ||
CREATE TABLE t15(a INTEGER ENCODING 'utf8')$$ | ||
CREATE TABLE t15(a TEXT ENCODING 'utf8')$$ | ||
CREATE TABLE t15(a CHAR(10) ENCODING 'utf8')$$ | ||
SELECT csc2 FROM sqlite_master WHERE name='t15' | ||
INSERT INTO t15 VALUES (CAST(x'616263FF616263' AS TEXT)) | ||
SELECT COUNT(*) FROM t15 | ||
ALTER TABLE t15 ALTER COLUMN a ENCODING NONE$$ | ||
INSERT INTO t15 VALUES (CAST(x'616263FF616263' AS TEXT)) | ||
SELECT COUNT(*) FROM t15 | ||
ALTER TABLE t15 ALTER COLUMN a ENCODING 'utf8'$$ | ||
DROP TABLE t15 |
Oops, something went wrong.