[MDEV-33389] sql_mode allows creation of illedal stored generated column Created: 2024-02-05  Updated: 2024-02-05

Status: Confirmed
Project: MariaDB Server
Component/s: Virtual Columns
Affects Version/s: 10.5, 10.6, 10.11, 11.0, 11.1, 11.2
Fix Version/s: 10.5, 10.6, 10.11, 11.0, 11.2

Type: Bug Priority: Major
Reporter: Sergei Golubchik Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

MariaDB [test]> CREATE TABLE t1 (a int unsigned  AS ( CAST(0 AS UNSIGNED)  -1) STORED);
ERROR 1901 (HY000): Function or expression 'cast(0 as unsigned) - 1' cannot be used in the GENERATED ALWAYS AS clause of `a`
MariaDB [test]> set sql_mode=no_unsigned_subtraction;
Query OK, 0 rows affected (0.000 sec)
MariaDB [test]> CREATE TABLE t1 (a int unsigned  AS ( CAST(0 AS UNSIGNED)  -1) STORED);
Query OK, 0 rows affected (0.014 sec)

there are other sql modes that affect other functions and expressions. may be they're also affected, I didn't check that


Generated at Thu Feb 08 10:38:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.