CONCAT produces extra trailing bytes for a BLOB argument in a UTF-16le database
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by reproducing the SQL script against a newly created database, setting UTF-16le encoding before creating tables; compare the HEX results for the direct cast and CONCAT. The issue names no source files or tests, so trace CONCAT's handling of BLOB arguments and BLOB-to-text conversion in the SQLite code bundled with sqlite-jdbc. Done means the single-argument CONCAT result matches the expected text without trailing bytes, with the UTF-16le case verified.
Written by the indexing model from the issue text.
Description
I observed unexpected trailing bytes when passing a BLOB argument to CONCAT() in a UTF-16le database.
Reproduction
Run this script against a newly created, empty database. The encoding must be set before creating any tables.
PRAGMA encoding = 'UTF-16le';
CREATE TABLE t(x);
INSERT INTO t VALUES(960613696.0);
PRAGMA encoding;
SELECT
HEX(CAST(CAST(x AS BLOB) AS TEXT)) AS direct_text,
HEX(CONCAT(CAST(x AS BLOB))) AS concatenated
FROM t;
SELECT sqlite_version(), sqlite_source_id();
Actual result
direct_text:
3900360030003600310033003600390036002E003000
concatenated:
3900360030003600310033003600390036002E00300000000300000000000000000000000000000000000000
The CONCAT result contains the expected prefix followed by additional bytes.
Expected result
I would expect CONCAT() with this single non-NULL argument to produce the same text content as the explicit conversion to TEXT, without additional trailing bytes.
Version tested
SQLite 3.51.1
2025-11-28 17:28:25
281fc0e9afc38674b9b0991943b9e9d1e64c6cbdb133d35f6f5c87ff6af38a88
I also tested a development Fiddle build:
SQLite 3.54.0
2026-10-05 14:22:13
4bfc6e53a95d710b7f40fa9c80d8cdd1df50d69ed8614e9800f7e6a1ca5a3c29
However, that test produced UTF-8 output, so it did not reproduce the same encoding conditions. I have not yet verified whether the issue persists in the development build with a UTF-16le database.
Is this a known or already-fixed issue involving CONCAT(), BLOB-to-text conversion, and UTF-16 database encoding?
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 676
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 18
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xerial/sqlite-jdbc
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
xerial/sqlite-jdbc#1515 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
xerial/sqlite-jdbc#1514 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
xerial/sqlite-jdbc#1513 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
xerial/sqlite-jdbc#1512 ·
Maintainers usually reply within 1 day
-
SIGSEGV (exit 134) in bundled `rightstr()` when the length argument is a large negative numberPossibly taken @sarthakdev143-lite claimed this 1 day ago. Openhelp wanted impacts:JNI
Difficulty 4/5 1-2 days Newbie friendliness 38/100
xerial/sqlite-jdbc#1508 ·
Maintainers usually reply within 1 day
All issues in xerial/sqlite-jdbc
Similar issues
-
Area/Configuration Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ballerina-platform/static-code-analysis-tool#217 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eclipse-dirigible/dirigible#8636 · 1 comment ·
Maintainers usually reply within 1 day
-
bug severity-medium XS
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
nikolas-charalambidis/facepalm-maven-plugin#291 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
OakLoaf/PluginUpdater#264 ·
Maintainers usually reply within 1 day
-
[Bug]: withStartupTimeout() changes the startup timeout of all containers that use the default wait strategyPossibly taken @aymenjamaaoui claimed this today. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
testcontainers/testcontainers-java#12171 ·
Maintainers usually reply within 1 day