Commit fe8cf7f1 authored by Varun Gupta's avatar Varun Gupta

MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP...

MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD

Fixed by the commit cb11b3fb.
Adding the test case for this issue.
parent a4e58882
...@@ -6750,5 +6750,19 @@ testcase ...@@ -6750,5 +6750,19 @@ testcase
drop view v1; drop view v1;
drop table t1; drop table t1;
# #
# MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD
#
CREATE TABLE t1 (id INT, f VARCHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'a'),(2,'b');
CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1;
CALL sp;
ERROR 42000: Can't group on 'f2'
CALL sp;
ERROR 42000: Can't group on 'f2'
DROP PROCEDURE sp;
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
...@@ -6462,6 +6462,22 @@ SELECT * FROM v1; ...@@ -6462,6 +6462,22 @@ SELECT * FROM v1;
drop view v1; drop view v1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-18502: Server crash in find_field_in_tables upon 2nd execution of SP which causes ER_WRONG_GROUP_FIELD
--echo #
CREATE TABLE t1 (id INT, f VARCHAR(1));
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'a'),(2,'b');
CREATE PROCEDURE sp() SELECT f AS f1, MAX(id) AS f2 FROM v1 GROUP BY f1, f2 ORDER BY f1;
--error ER_WRONG_GROUP_FIELD
CALL sp;
--error ER_WRONG_GROUP_FIELD
CALL sp;
DROP PROCEDURE sp;
DROP VIEW v1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment