Dolt returns no rows for EXCEPT-based intersection when the matching value is an empty string
Author: Zhs17Created Sep 28, 2026Updated Sep 30, 2026
Labelsbuggood reprocustomer issue
Summary
Dolt 2.3.2 returns an empty result for an EXCEPT expression that is equivalent to an intersection when the matching value is the empty string ('').
With the same tables and rows, a direct INNER JOIN and an INTERSECT query both return the matching empty string. The equivalent EXCEPT-based expressions return no rows.
Environment
- Dolt: 2.3.2
SELECT dolt_version()returns2.3.2SELECT VERSION()returns8.0.31- Tables use
utf8mb4andutf8mb4_bin - No primary keys or indexes
Reproduction
Run the following in a fresh database:
CREATE DATABASE dolt_except_empty_repro
CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
USE dolt_except_empty_repro;
CREATE TABLE a (
k VARCHAR(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
);
CREATE TABLE b (
k VARCHAR(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
);
INSERT INTO a VALUES ('');
INSERT INTO b VALUES ('');
-- Query 1: returns one row containing ''
SELECT DISTINCT b.k FROM a INNER JOIN b ON a.k = b.k;
-- Query 2: returns one row containing ''
(SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)
INTERSECT
(SELECT DISTINCT b.k FROM a RIGHT JOIN b ON a.k = b.k);
-- Query 3: expected to return one row containing '', but Dolt returns no rows
(SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)
EXCEPT
((SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)
EXCEPT
(SELECT DISTINCT b.k FROM a RIGHT JOIN b ON a.k = b.k));
-- Query 4: equivalent intersection rewrite; expected to return one row
-- containing '', but Dolt returns no rows
((SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)
UNION
(SELECT DISTINCT b.k FROM a RIGHT JOIN b ON a.k = b.k))
EXCEPT
(((SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)
EXCEPT
(SELECT DISTINCT b.k FROM a RIGHT JOIN b ON a.k = b.k))
UNION
((SELECT DISTINCT b.k FROM a RIGHT JOIN b ON a.k = b.k)
EXCEPT
(SELECT DISTINCT b.k FROM a LEFT JOIN b ON a.k = b.k)));Expected behavior
All four queries should return exactly one row containing the empty string. In particular, Query 3 is equivalent to an intersection:
A EXCEPT (A EXCEPT B) = A INTERSECT BSince both input tables contain the same value, '', the result should contain that value.
Actual behavior
On Dolt 2.3.2:
- Query 1 returns one row containing ''.
- Query 2 returns one row containing ''.
- Queries 3 and 4 return no rows. The same schema and queries returned one row containing '' for all four expressions on MySQL 8.4.7, MySQL 8.0.46, MySQL 26.7.0, and MariaDB 12.3.2.
Source: dolthub/dolt