mariadb/mysql-test/suite/sql_sequence/view.test
Monty 3f32743294 MDEV-13020 Server crashes in Item_func_nextval::val_int...
The problem was that we didn't check on open of sequence if the table is a view, which is not allowed.
We are now generating a proper error message for this case.
2017-07-06 10:59:45 +03:00

29 lines
646 B
Text

--source include/have_sequence.inc
--source include/have_innodb.inc
#
# Test sequences with views
#
create sequence s1;
create view v1 as select * from s1;
create view v2 as select next value for s1;
select * from v1;
select * from v2;
select * from v2;
--error ER_NOT_SEQUENCE
select next value for v1;
drop sequence s1;
drop view v1,v2;
--echo #
--echo # MDEV 13020 Server crashes in Item_func_nextval::val_int upon
--echo # selecting NEXT or PREVIOUS VALUE for a view
--echo #
CREATE OR REPLACE VIEW v1 AS SELECT 1 AS f;
--error ER_NOT_SEQUENCE
SELECT NEXT VALUE FOR v1;
--error ER_NOT_SEQUENCE
SELECT PREVIOUS VALUE FOR v1;
drop view v1;