-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
opt: do not include virtual computed columns in lock columns
Virtual computed columns cannot be included in lock columns because these columns are fetched from the primary index when the lock is translated into a lookup join. The primary index does not actually store virtual columns, so attempting to fetch `NOT NULL` virtual columns would confuse the execution engine into thinking they should be present, and cause errors with the message "internal error: Non-nullable column ...". Fixes #130661 Release note (bug fix): A bug has been fixed which could cause errors with the message "internal error: Non-nullable column ..." when executing statements under read-committed isolation that involve tables with `NOT NULL` virtual columns.
- Loading branch information
Showing
3 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Tests for read-committed isolation level. | ||
|
||
exec-ddl | ||
CREATE TABLE t130661 ( | ||
id INT PRIMARY KEY, | ||
i INT NOT NULL, | ||
v INT AS (i + 10) VIRTUAL NOT NULL | ||
) | ||
---- | ||
|
||
# Regression test for #130661. The lock columns should not include virtual | ||
# computed columns (in this case the column with ID 8). | ||
build isolation=ReadCommitted | ||
SELECT * FROM t130661 WHERE id = 1 FOR UPDATE | ||
---- | ||
lock t130661 | ||
├── columns: id:1!null i:2!null v:3!null | ||
├── key columns: id:1 | ||
├── lock columns: (6,7) | ||
├── locking: for-update,durability-guaranteed | ||
└── project | ||
├── columns: id:1!null i:2!null v:3!null | ||
└── select | ||
├── columns: id:1!null i:2!null v:3!null crdb_internal_mvcc_timestamp:4 tableoid:5 | ||
├── project | ||
│ ├── columns: v:3!null id:1!null i:2!null crdb_internal_mvcc_timestamp:4 tableoid:5 | ||
│ ├── scan t130661 | ||
│ │ ├── columns: id:1!null i:2!null crdb_internal_mvcc_timestamp:4 tableoid:5 | ||
│ │ └── computed column expressions | ||
│ │ └── v:3 | ||
│ │ └── i:2 + 10 | ||
│ └── projections | ||
│ └── i:2 + 10 [as=v:3] | ||
└── filters | ||
└── id:1 = 1 |