Bug #114531 Create table as select missing default value

Submitted: 2 Apr 2024 15:32 Modified: 4 Apr 2024 9:59
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[2 Apr 2024 15:32] Pedro Ferreira
Description:
Run this statement:

mysql> CREATE TABLE t0 (c0 INT AS (1) NOT NULL, c1 INT) AS (SELECT 5 c1);
ERROR 1364 (HY000): Field 'c0' doesn't have a default value

c0 doesn't have a default value, but on this case it shouldn't be needed because it's a generated column. Is this error expected?

The compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

How to repeat:
Run the statement above.
[3 Apr 2024 10:20] MySQL Verification Team
Hi Mr. Ferreira,

Thank you for your bug report.

However, this is not a bug.

There are some restrictions when you create a table with generated columns from a SELECT statement.

This is described here:

https://dev.mysql.com/doc/refman/8.3/en/create-table-generated-columns.html

Not a bug.
[4 Apr 2024 9:59] MySQL Verification Team
HI Mr. Ferreira,

After further examining the standard, we concluded that this is a bug..

Verified as reported.

It affects 8.0 and higher versions.

Thank you.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 4.145 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.