dolt icon indicating copy to clipboard operation
dolt copied to clipboard

Columns that are named `commit` or `commit_date` appear as NULL in the `dolt_diff_{table_name}` system table.

Open druvv opened this issue 2 years ago • 2 comments

Repro:

dolt sql -q "CREATE table t (pk int, commit text);"
dolt sql -q "INSERT INTO t VALUES (1, 'hi');"
dolt commit -am "initial"

Table data:

dolt sql -q "SELECT * from t"
+----+--------+
| pk | commit |
+----+--------+
| 1  | hi     |
+----+--------+

Diff table:

$ dolt sql -q "SELECT * from dolt_diff_t;"
+-----------+-------+----------------------------------+-----------------------------------+-------------+---------+----------------------------------+-----------------------------------+-----------+
| to_commit | to_pk | to_commit                        | to_commit_date                    | from_commit | from_pk | from_commit                      | from_commit_date                  | diff_type |
+-----------+-------+----------------------------------+-----------------------------------+-------------+---------+----------------------------------+-----------------------------------+-----------+
| NULL      | 1     | 736lsfds067c30freqtve8o0v7lsrmpe | 2022-05-11 20:21:31.744 +0000 UTC | NULL        | NULL    | 83amk1pnul86ajecveuu4e44ie63c0gp | 2022-05-11 20:20:00.975 +0000 UTC | added     |

It seems like we need a better story around how the dolt_diff column names are generated. In the meantime, we can at-least fix the missing data ("hi");

druvv avatar May 11 '22 20:05 druvv

fixed in #3401

druvv avatar May 20 '22 16:05 druvv

Just rediscovering this.

This query shouldn't even pass analysis, because the table schema has two columns with the same name, making it ambiguous. We need to come up with a method to disambiguate user columns when they collide with generated ones.

zachmu avatar Jun 17 '22 22:06 zachmu