Skip to content

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

@DavidLokison

Description

@DavidLokison

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,);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions