cockroachdb / cockroachdb/cockroach
sql: unsafe enum use in transaction
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
The following behavior is not allowed in postgres:
```
CREATE TYPE bogus AS ENUM('good');
BEGIN;
ALTER TYPE bogus ADD VALUE 'new';
SAVEPOINT x;
SELECT enum_last(null::bogus); -- unsafe use of new value "new" of enum type bogus
ROLLBACK TO x;
SELECT enum_range(null::bogus);-- unsafe use of new value "new" of enum type bogus
ROLLBACK TO x;
COMMIT;
-- Now the commands can succeed.
```
In crdb, we return `good` and `{good}`, respectively, instead of an error.
Found in pg_regress enum
Jira issue: CRDB-33908
Epic CRDB-60818
Contributor guide
Assessment
This issue has not been assessed yet.