# Technical Advisory 73629

Publication date: December 14, 2021

## Description

In versions of CockroachDB 21.1 and 21.2 prior to 21.1.13 and 21.2.3, planning queries over partitioned tables with a `DEFAULT` partition in a `PARTITION BY LIST` clause could cause a spurious internal error with text “empty Datums being compared to other”. This issue could occur when a query contained a `WHERE` clause including at least one indexed column from the partitioned index, but not the first column.

The issue does not exist on 20.2 and prior versions.

## Statement

This is resolved in CockroachDB by PR 73630, which prevents queries over tables with a `DEFAULT` partition from causing the internal error “empty Datums being compared to other”.

The fix has been applied to maintenance releases of CockroachDB 21.1.13 and 21.2.3.

This issue is tracked by public issue 73629.

## Mitigation

Users of CockroachDB 21.1 and 21.2 using partitioned tables with a `DEFAULT` partition in a `PARTITION BY LIST` clause are encouraged to upgrade to 21.1.13, 21.2.3, or a later version. To avoid further errors while still on prior versions, users can either remove the `DEFAULT` partition, or if this is not possible, ensure that their queries always have a predicate on the first column of the partitioned index when there is a `WHERE` clause. For example:

Given a table:

    CREATE TABLE abc (
      a STRING NOT NULL,
      b STRING NOT NULL,
      c INT,
      PRIMARY KEY (a, b)
    ) PARTITION BY LIST (a) (
      PARTITION p1 VALUES IN (('foo'), ('bar')),
      PARTITION p2 VALUES IN (('baz')),
      PARTITION DEFAULT VALUES IN (default)
    );

And a query that causes an internal error on 21.1.12 and 21.2.2:

    SELECT * FROM abc WHERE b = 'foobar';

Users can avoid the error by augmenting the query as follows:

    SELECT * FROM abc WHERE b = 'foobar' AND a != 'some-non-existent-value';

This workaround of adding a predicate may hurt performance so the best mitigation is to upgrade to 21.1.13 or 21.2.3 as soon as possible. The additional predicate can be removed upon upgrading to 21.1.13 or 21.2.3.

Note:

21.1.13 will be released on Jan 10, 2022.

## Impact

Users of CockroachDB 21.1 and 21.2 using partitioned tables with a `DEFAULT` partition in a `PARTITION BY LIST` clause may not have been able to run certain queries in their workload due to an internal error during planning.

Please reach out to the support team if you need more information or assistance.