cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.52k stars 3.7k forks source link

ERROR: verify-idx-count: incompatible value type: cannot determine type of empty array #126738

Closed chenglinLiang closed 23 hours ago

chenglinLiang commented 4 days ago

Describe the problem

I encountered an error when creating an index on a table. However, when I used an equivalent SQL to create the table and the index, there was no error.

To Reproduce Error

CREATE TABLE t0 (
    c0 TIME CHECK (
        (
            ARRAY[B'1']
        ) NOT BETWEEN SYMMETRIC (
            CASE  
                WHEN false THEN ARRAY[] 
                ELSE ARRAY[] 
            END
        ) AND (
            ARRAY[B'1']
        )
    )
);
CREATE INDEX ON t0(c0);
ERROR: verify-idx-count: incompatible value type: cannot determine type of empty array. Consider casting to the desired type, for example ARRAY[]::int[]
SQLSTATE: 42P18

Correct

CREATE TABLE t0 (
    c0 TIME CHECK (
        (
            ARRAY[B'1']
        ) NOT BETWEEN SYMMETRIC (
            ARRAY[] 
        ) AND (
            ARRAY[B'1']
        )
    )
);
CREATE INDEX ON t0(c0);

Expected behavior No error.

Environment:

Jira issue: CRDB-40095

blathers-crl[bot] commented 4 days ago

Hi @chenglinLiang, please add branch-* labels to identify which branch(es) this C-bug affects.

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

blathers-crl[bot] commented 4 days ago

Hello, I am Blathers. I am here to help you get the issue triaged.

Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here.

I was unable to automatically find someone to ping.

If we have not gotten back to your issue within a few business days, you can try the following:

:owl: Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

yuzefovich commented 23 hours ago

Thanks for the report! I think this is a dup of #114316 and should be fixed on latest versions.