Create inverted index issue

Hi,

Is this a bug or am I doing something wrong? The scenario is that we want to add a JSON column type to a table that already has data and then create an inverted index on the JSON column.

CREATE TABLE t (id int);

INSERT INTO t (id) VALUES (1), (2);

ALTER TABLE t ADD column j json;

CREATE INVERTED INDEX ON t(j);

pq: validation of index t_j_idx failed: expected 0 rows, found 2

Thanks for the report. It’s a bug. I filed https://github.com/cockroachdb/cockroach/issues/38714 to track it.