Skip to content

sql: prepared statements against tables with enum types not invalidated when enum changes #70378

@jordanlewis

Description

@jordanlewis

The following sequence of commands should work properly, but instead return an error. The issue seems to be that the prepared statement doesn't notice that the table that it's referencing has an ENUM type that got modified, causing it to refresh its referenced descriptors.

create type t as enum('a');
create table tab (t t);
prepare x as insert into tab values($1);
execute x('a');
alter type t add value 'b';
execute x('b');

ERROR: invalid input value for enum t: "b"
SQLSTATE: 22P02
demo@127.0.0.1:26257/defaultdb>

I'd expect that this should work fine, or at worst, the error should be about the prepared statement being out of date or something.

Epic CRDB-8948

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions