Using a sub-string of the column name in creating index

Moving form oracle to cockroach-db, I’m using a index creating command as bellow:

CREATE INDEX ON “sales” (substring(“a”,0,19), substring(“b”,20,2), “c”);

The error I get is:

invalid syntax: statement ignored: unimplemented at or near ")"
CREATE INDEX ON “sales” (substring(“a”,0,19), substring(“b”,20,2), “c”);

                                       ^

I have also used, substr, but the error is the same.

Hi @Cyrus,

It’s me again! Sharing my answer from StackOverflow:

You’re trying to use a computed index - an index with keys that are more complex than column references. CockroachDB doesn’t support computed indexes yet.

There’s an open issue for adding support for computed indexes:

https://github.com/cockroachdb/cockroach/issues/9682