[MDEV-31610] Column CHECK referring invisible column prevents CREATE .. SELECT Created: 2023-07-03 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Create Table |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1 |
| Fix Version/s: | 10.4, 10.5, 10.6, 10.11, 11.0, 11.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Description |
|
The chain of "thought" is easy to guess – SELECT only selects column `b`, because column `a` is invisible, but CREATE tries to preserve the check constraint on column `b`, and it turns out it refers to a column which wasn't selected. It is still strange however and does not look right.
|
| Comments |
| Comment by Sergei Golubchik [ 2023-07-03 ] |
|
Generally, in CREATE TABLE ... SELECT, the SELECT part produces a result set and CREATE TABLE should create a table based on that. Default column values, indexes, constraints — they aren't part of the result set, so shouldn't be transferred over. Historically, some of that was transferred over, though, and some — rather inconsistently — wasn't. |