Bug #108775 Create table with year cast assertion error
Submitted: 14 Oct 2022 9:06 Modified: 14 Oct 2022 10:01
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.0.31 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_64)
Tags: CREATE TABLE, year

[14 Oct 2022 9:06] Pedro Ferreira
Description:
The following query:

CREATE TABLE t0 (c0 YEAR) AS (VALUES ROW(CAST(DATE '2000-1-1' AS YEAR)),ROW(CAST(1986 AS YEAR)));

Triggers an assertion error at item.cc:6408

assert(max_length == 4);

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 query above.
[14 Oct 2022 9:07] Pedro Ferreira
Changed the category to something more appropriate.
[14 Oct 2022 9:08] Pedro Ferreira
It's DDL not DML
[14 Oct 2022 10:01] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Observed that 8.0.31 debug build is affected.

regards,
Umesh
[14 Oct 2022 10:11] MySQL Verification Team
- 8.0.31 debug build is affected

 ./mtr bug108775 --nocheck-testcases --debug-server
Logging: ./mtr  bug108775 --nocheck-testcases --debug-server
MySQL Version 8.0.31
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/mysql-8.0.31/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
CREATE TABLE t0 (c0 YEAR) AS (VALUES ROW(CAST(DATE '2000-1-1' AS YEAR)),ROW(CAST(1986 AS YEAR)));
[ 50%] main.bug108775                            [ fail ]
        Test ended at 2022-10-14 12:01:43

CURRENT_TEST: main.bug108775
mysqltest: At line 1: Query 'CREATE TABLE t0 (c0 YEAR) AS (VALUES ROW(CAST(DATE '2000-1-1' AS YEAR)),ROW(CAST(1986 AS YEAR)))' failed.
ERROR 2013 (HY000): Lost connection to MySQL server during query