CONCAT produces extra trailing bytes for a BLOB argument in a UTF-16le database

オープン
#1,483 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java, sql, sqlite

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

triage

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?

主要言語
Java
スター
3.3k
フォーク
676
平均マージ
1日 15時間
マージ済み PR(30日)
18

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

xerial/sqlite-jdbc のほかの issue

xerial/sqlite-jdbc の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。