cockroachdb / cockroachdb/cockroach

sql: unsafe enum use in transaction

Open
#115,138 0 comments 0 reactions 0 assignees View on GitHub
A-schema-catalog A-schema-transactional A-sql-pgcompat C-bug E-quick-win O-pg-regress T-sql-foundations
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.