Skip to content

sql: nullability not respected for virtual computed columns #81675

@ajwerner

Description

@ajwerner
CREATE TABLE t (i INT PRIMARY KEY);
INSERT INTO t VALUES (1);
ALTER TABLE t ADD COLUMN j INT AS (NULL::INT) VIRTUAL NOT NULL;
SELECT j FROM t;
   j
--------
  NULL

Expected behavior
I think we should probably validate the column when adding it and then evaluate the expression and enforce the constraint when inserting and updating rows.

Jira issue: CRDB-16023

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