Skip to content

Commit 58a2f23

Browse files
garlickmergify[bot]
authored andcommitted
content-sqlite: use BLOB type for hash keys
Problem: CHAR(20) type for hash keys would appear to truncate sha256 hash keys, and implies that character set encoding/collation code is used in key comparisons. It turns out that content-sqlite ignores the CHAR length parameter, and that character set stuff may be effectively a no-op here - at least simple tests in #2795 show that it may be equivalent to BLOB in terms of stored size and comparison overhead. Anyway, CHAR(20) looks wrong, so change it to BLOB. Fixes #2795
1 parent ef5f05b commit 58a2f23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/modules/content-sqlite/content-sqlite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const size_t lzo_buf_chunksize = 1024*1024;
3636
const size_t compression_threshold = 256; /* compress blobs >= this size */
3737

3838
const char *sql_create_table = "CREATE TABLE if not exists objects("
39-
" hash CHAR(20) PRIMARY KEY,"
39+
" hash BLOB PRIMARY KEY,"
4040
" size INT,"
4141
" object BLOB"
4242
");";

0 commit comments

Comments
 (0)