Publication date: March 1, 2023
In all versions of CockroachDB from v22.2.0-alpha.1 to v22.2.3, altering a non-empty table to add a column with a
DEFAULT expression in which the type of the expression does not match the type of the new column could cause the column to become corrupted. For example,
ALTER TABLE t ADD COLUMN c DECIMAL DEFAULT pi();. This happens because the
DEFAULT expression is not cast to the correct type when the column is backfilled for the existing rows in the table. As a result, a later attempt to read the data in that column could cause the decoding logic to panic and crash the node.
This is resolved in CockroachDB by #95398, which casts the
DEFAULT expression to the correct type when backfilling a new column.
The fix has been applied to the maintenance release of CockroachDB v22.2.5.
This public issue is tracked by #93398.
If you discover that you have a table with a column that has become corrupted due to this issue, the best mitigation is to drop and recreate the column after upgrading. However, if the corrupted column contains data that must not be lost, please contact the support team.
A column added to an existing non-empty table with a
DEFAULT expression in which the type of the expression does not exactly match the type of the column could become corrupted. This causes attempts to access data in the table to panic and crash the node. Versions affected include CockroachDB v22.2.0-alpha.1 to v22.2.3.
Please reach out to the support team if more information or assistance is needed.