mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
MDEV-5717: Server crash with insert statement containing DEFAULT into view
Item_default_value::arg can be NULL so walk() should take it into consideration.
This commit is contained in:
@@ -4790,6 +4790,22 @@ v1_field1
|
||||
deallocate prepare my_stmt;
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
#
|
||||
#MDEV-5717: Server crash with insert statement containing DEFAULT into
|
||||
#view
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`test` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
CREATE VIEW v1 AS (select t1.id AS id, t1.test AS test from t1);
|
||||
INSERT INTO v1 SET test = DEFAULT;
|
||||
select * from v1;
|
||||
id test
|
||||
1 0
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
# -----------------------------------------------------------------
|
||||
# -- End of 5.3 tests.
|
||||
# -----------------------------------------------------------------
|
||||
|
||||
@@ -4720,6 +4720,25 @@ deallocate prepare my_stmt;
|
||||
DROP VIEW v1,v2;
|
||||
DROP TABLE t1,t2,t3,t4;
|
||||
|
||||
--echo #
|
||||
--echo #MDEV-5717: Server crash with insert statement containing DEFAULT into
|
||||
--echo #view
|
||||
--echo #
|
||||
CREATE TABLE t1 (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`test` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
CREATE VIEW v1 AS (select t1.id AS id, t1.test AS test from t1);
|
||||
|
||||
INSERT INTO v1 SET test = DEFAULT;
|
||||
|
||||
select * from v1;
|
||||
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.3 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
||||
@@ -3551,7 +3551,7 @@ public:
|
||||
|
||||
bool walk(Item_processor processor, bool walk_subquery, uchar *args)
|
||||
{
|
||||
return arg->walk(processor, walk_subquery, args) ||
|
||||
return (arg && arg->walk(processor, walk_subquery, args)) ||
|
||||
(this->*processor)(args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user