SQLite Forum

sqlite3 CLI .expert mode returns “Error: not an error”, if suggested index name is created, but does not match suggestion
Login
Version found in:
3.34.1 (As shipped by Ubuntu 21.04) and the latest commit to trunk, which currently is [[af5dcc9c2a3a45d1](https://sqlite.org/src/info/af5dcc9c2a3a45d1)].


Minimal reproduction:

```sql
> CREATE TABLE t (a INTEGER PRIMARY KEY, b TEXT NOT NULL, c TEXT NOT NULL);
> .expert
> SELECT * from t AS t1 JOIN t AS t2 USING (b, c);
CREATE INDEX t_idx_00012959 ON t(c, b);

SCAN t1
SEARCH t2 USING COVERING INDEX t_idx_00012959 (c=? AND b=?)

> CREATE INDEX t_idx_00012959 ON t(c); -- Note that this is different from the suggested index.
> .expert
> SELECT * from t AS t1 JOIN t AS t2 USING (b, c);
Error: not an error
```

I found this, because I wanted to optimize an analysis query on a database. I reused the previously suggested index name, because using the history is faster than typing out the CREATE INDEX statement and coming up with a new name ;) .


My educated guess: This is caused by a name collision. Expert mode tries to suggest an index, but the name is unexpectedly already taken, because it assumes that the hash suffix is sufficient to prevent a collision.

Even if you don’t want to support this edge case, at least the error message should be improved :)