dolt icon indicating copy to clipboard operation
dolt copied to clipboard

dolt diff -r sql doesn't show values for BIT(n) types

Open DavidLokison opened this issue 1 month ago • 2 comments

When I try to extract diff data (but also try to show data, but for the diff it's most critical) that is of a BIT(n) type I get empty strings instead some value that can be fed back into a dolt sql statement. I use BIT types pretty often for flags, status fields and other tiny integers smaller than a full byte so being able to export them like so would be a great help for sure. Maybe even implementing a default way to show them other than converting them to a character (which is probably what's the underlying issue right now). My suggestion would be to just use the b'000' notation like when typing them in.

$ dolt init --fun
Successfully initialized dolt data repository.

$ dolt sql -q "CREATE TABLE t (id INT PRIMARY KEY, some_bitval BIT(3))"

$ dolt sql -q "INSERT INTO t (id, some_bitval) VALUES ROW(0, b'000'), ROW(1, b'001'), ROW(2, b'010')"

$ dolt sql -q "SELECT * FROM t"
+----+-------------+
| id | some_bitval |
+----+-------------+
| 0  |             |
| 1  |             |
| 2  |             |
+----+-------------+

$ dolt diff HEAD -r sql
CREATE TABLE `t` (
  `id` int NOT NULL,
  `some_bitval` bit(3),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin;
INSERT INTO `t` (`id`,`some_bitval`) VALUES (0,);
INSERT INTO `t` (`id`,`some_bitval`) VALUES (1,);
INSERT INTO `t` (`id`,`some_bitval`) VALUES (2,);

DavidLokison avatar Nov 26 '25 22:11 DavidLokison

Thanks for reporting this one David! We'll jump on this one asap, and should be an easy fix. Heads up that we're out for holiday Thursday/Friday this week, so turnaround may be a little longer than usual.

fulghum avatar Nov 26 '25 23:11 fulghum

Thank you! It's totally fine that it takes a little longer, my datasets aren't too large currently so I can just manually work around things. Happy holiday!

DavidLokison avatar Nov 26 '25 23:11 DavidLokison