dolthub / dolthub/dolt

dolt_blame returns no rows after schema-only dolt_revert

Open
#10,965 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 5h
Merged PRs (30d)
108

Description

## Problem

After a schema-only commit is reverted with `dolt_revert`, `dolt_blame_` can return zero rows even though the table still has live rows.

Doltlite returns the expected blame row here, so this looks like a Dolt-side blame / lineage bug.

## Repro

```sql
CREATE TABLE t(id INTEGER PRIMARY KEY, v TEXT);
INSERT INTO t VALUES (1, 'base');
CALL dolt_add('-A');
CALL dolt_commit('-m', 'c1');

CREATE TABLE t_new(id INTEGER PRIMARY KEY, v TEXT CHECK (length(v) > 0));
INSERT INTO t_new SELECT * FROM t;
DROP TABLE t;
ALTER TABLE t_new RENAME TO t;
CALL dolt_add('-A');
CALL dolt_commit('-m', 'main_check');

CALL dolt_revert((SELECT commit_hash FROM dolt_log WHERE message='main_check' LIMIT 1));

SELECT * FROM t;
SELECT count(*) FROM dolt_blame_t;
SELECT CONCAT('BL|', id, '|', message) FROM dolt_blame_t ORDER BY id;
```

## Actual behavior

`SELECT * FROM t;` returns the live row:

```text
1,base
```

But blame is empty:

```text
count(*) = 0
```

and

```text
SELECT CONCAT('BL|', id, '|', message) FROM dolt_blame_t ORDER BY id;
```

returns no rows.

## Expected behavior

`dolt_blame_t` should return one row for the live row in `t`, attributed to the original commit `c1`.

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.