Skip to content

Commit

Permalink
MDEV-13523: Group By in a View, called within a Stored Routine causes…
Browse files Browse the repository at this point in the history
… Error Code 1356 when a non-root user runs the routine for a second time

it is actually test suite for second code chunk fix in MDEV-13439
  • Loading branch information
sanja-byelkin committed Sep 6, 2017
1 parent 80c9088 commit 2b38785
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
35 changes: 35 additions & 0 deletions mysql-test/r/view.result
Original file line number Diff line number Diff line change
Expand Up @@ -6589,5 +6589,40 @@ use test;
drop database test_db;
drop user foo@localhost;
#
# MDEV-13523: Group By in a View, called within a Stored Routine
# causes Error Code 1356 when a non-root user runs the routine for
# a second time
#
CREATE DATABASE bugTest;
USE bugTest;
CREATE TABLE `procViewTable` (`id` int(10), `someText` varchar(50) NOT NULL);
insert into `procViewTable` values (1,'Test'), (2,'Test 2');
CREATE USER 'procView'@'%';
GRANT ALL PRIVILEGES ON `bugTest`.* TO 'procView'@'%';
CREATE DEFINER=`procView`@`%` VIEW `procViewSimple` AS (
select * from (
select `id` from `bugTest`.`procViewTable`
) `innerQuery`
group by `innerQuery`.`id`
);
connect con1,localhost,procView,,;
use bugTest;
prepare stmt from "SELECT * FROM procViewSimple";
execute stmt;
id
1
2
execute stmt;
id
1
2
disconnect con1;
connection default;
drop user procView;
drop view procViewSimple;
drop table procViewTable;
use test;
drop database bugTest;
#
# End of 10.2 tests
#
38 changes: 38 additions & 0 deletions mysql-test/t/view.test
Original file line number Diff line number Diff line change
Expand Up @@ -6306,6 +6306,44 @@ use test;
drop database test_db;
drop user foo@localhost;

--echo #
--echo # MDEV-13523: Group By in a View, called within a Stored Routine
--echo # causes Error Code 1356 when a non-root user runs the routine for
--echo # a second time
--echo #

CREATE DATABASE bugTest;
USE bugTest;

CREATE TABLE `procViewTable` (`id` int(10), `someText` varchar(50) NOT NULL);
insert into `procViewTable` values (1,'Test'), (2,'Test 2');

CREATE USER 'procView'@'%';
GRANT ALL PRIVILEGES ON `bugTest`.* TO 'procView'@'%';

CREATE DEFINER=`procView`@`%` VIEW `procViewSimple` AS (
select * from (
select `id` from `bugTest`.`procViewTable`
) `innerQuery`
group by `innerQuery`.`id`
);

--connect (con1,localhost,procView,,)
use bugTest;

prepare stmt from "SELECT * FROM procViewSimple";
execute stmt;
execute stmt;

# Cleanup
--disconnect con1
--connection default
drop user procView;
drop view procViewSimple;
drop table procViewTable;
use test;
drop database bugTest;

--echo #
--echo # End of 10.2 tests
--echo #

0 comments on commit 2b38785

Please sign in to comment.