1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-25560 Creating table with certain generated column crashes server

Fix RPAD() handling without 3rd argument of padding, in which case default
padding is used.
This commit is contained in:
Nikita Malyavin
2021-06-28 20:59:29 +03:00
parent b50ea90063
commit dba7cd25e1
3 changed files with 47 additions and 6 deletions

View File

@ -5153,5 +5153,21 @@ c1
42
DROP TABLE t1, t2;
#
# MDEV-25560 Creating table with certain generated column crashes server
#
CREATE TABLE t1 (i int, b int AS (RPAD(123,1)) stored);
# Original case from the reporter
CREATE TABLE crash_test_2 (
DATA_VALUE CHAR(10) NULL,
HAS_DATA BIT NOT NULL,
TEST_COLUMN CHAR(10) AS (RPAD(CASE WHEN HAS_DATA = 1
THEN DATA_VALUE ELSE NULL END, 10)) STORED);
Warnings:
Warning 1901 Function or expression 'rpad(case when `HAS_DATA` = 1 then `DATA_VALUE` else NULL end,10)' cannot be used in the GENERATED ALWAYS AS clause of `TEST_COLUMN`
Warning 1105 Expression depends on the @@sql_mode value PAD_CHAR_TO_FULL_LENGTH
# Cleanup
DROP TABLE t1;
DROP TABLE crash_test_2;
#
# End of 10.3 tests
#