cockroachdb / cockroachdb/cockroach

SHOW FINGERPRINTS doesn't include non-keyside columns

Open
#157,222 1 comment 0 reactions 0 assignees View on GitHub
branch-master C-bug T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

The new implementation of SHOW FINGERPRINTS uses datums_to_bytes(), which does a keyside encoding on the datums. If a datum type doesn't have a keyside encoding, it doesn't get included in the output. As a result, applications that use SHOW FINGERPRINTS to detect changes in data on tables with columns that are not valid in keys will not detect if those columns change.

```
demo@127.0.0.1:26257/demoapp/defaultdb> CREATE TABLE foo (id INT PRIMARY KEY, embedding VECTOR(3));
CREATE TABLE

Time: 7ms total (execution 5ms / network 3ms)

demo@127.0.0.1:26257/demoapp/defaultdb> INSERT INTO foo VALUES (1, '[1, 2, 3]'), (2, '[2, 3, 4]'), (3, '[3, 4, 5]');
INSERT 0 3

Time: 3ms total (execution 2ms / network 0ms)

demo@127.0.0.1:26257/demoapp/defaultdb> SHOW FINGERPRINTS FROM TABLE foo;
ERROR: hash-fingerprint: illegal argument 1 of type vector
SQLSTATE: 42804
```

INSPECT also suffers from this, electing to skip the checksum pre-check if any datum is not compatible with datums_to_bytes().

Maybe the right thing to do is to figure out a way to make datums_to_bytes() eat these values?

Jira issue: CRDB-56424

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.