-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: prepared statements against tables with enum types not invalidated when enum changes #70378
Copy link
Copy link
Closed
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code 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)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code 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)SQL Foundations Team (formerly SQL Schema + SQL Sessions)