SQLite User Forum

collation and affinity loss in full join using
Login

collation and affinity loss in full join using

(1) By ChiZhang on 2026-05-15 11:23:01 [source]

Hi,

I found that the collation and affinity loss with FULL JOIN USING.

This test case can reproduce this:

CREATE TABLE x1(x COLLATE nocase);
CREATE TABLE x2(x);
INSERT INTO x1 VALUES('ABC');

SELECT count(*) FROM x1 WHERE x='abc'; -- correct: 1
SELECT count(*) FROM x1 FULL JOIN x2 USING(x) WHERE x='abc'; -- incorrect: 0
SELECT count(*) FROM x1 FULL JOIN x2 USING(x)
 WHERE x='abc' COLLATE nocase; -- correct: 1

DROP TABLE x1;
DROP TABLE x2;

CREATE TABLE t1(x REAL);
CREATE TABLE t2(x);
INSERT INTO t1 VALUES(1.0);

SELECT count(*) FROM t1 WHERE x='1'; -- correct: 1
SELECT count(*) FROM t1 FULL JOIN t2 USING(x) WHERE x='1'; -- incorrect: 0

I can reproduce this on the trunk version 83d3a0d39b.