dolthub / dolthub/dolt

`dolt diff` shows NULL values for virtual generated columns

Open
#8,879 9 comments 0 reactions 1 assignee Claimed by @zachmu View on GitHub
cli
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

Repro steps:

```
create table test(pk int primary key, c0 int generated always as (pk + 1));
insert into test(pk) values (1), (2);
```

`dolt diff` will produce the following output:

```
diff --dolt a/test b/test
added table
+CREATE TABLE `test` (
+ `pk` int NOT NULL,
+ `c0` int GENERATED ALWAYS AS ((`pk` + 1)),
+ PRIMARY KEY (`pk`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin;
+---+----+------+
| | pk | c0 |
+---+----+------+
| + | 1 | NULL |
| + | 2 | NULL |
+---+----+------+
```

This is likely because `c0` is virtual, so the tuples in the table don't actually contain a value for it. Displaying the correct values would require evaluating the stored expression for that column, which requires a SQL engine.

As for the correct behavior here, I'm leaning towards excluding virtual generated columns from `dolt diff` entirely, since they aren't actually part of the data in the diff.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.