Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
05208258
Commit
05208258
authored
May 17, 2012
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test suite of fixed bug (LP bug#993459).
parent
3d37b67b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
269 additions
and
2 deletions
+269
-2
mysql-test/r/ps.result
mysql-test/r/ps.result
+104
-0
mysql-test/r/sp.result
mysql-test/r/sp.result
+39
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+90
-2
mysql-test/t/sp.test
mysql-test/t/sp.test
+36
-0
No files found.
mysql-test/r/ps.result
View file @
05208258
...
@@ -3125,3 +3125,107 @@ Handler_read_rnd_deleted 0
...
@@ -3125,3 +3125,107 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
Handler_read_rnd_next 0
deallocate prepare st;
deallocate prepare st;
drop table t1;
drop table t1;
#
# LP bug#993459 Execution of PS for a query with GROUP BY
# returns wrong result (see also mysql bug#13805127)
#
PREPARE s1 FROM
"
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE @x = 1
UNION
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2
";
SET @x = 1;
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE @x = 1
UNION
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2;
c1 c2 count(c3)
2012-03-01 01:00:00 3 1
2012-03-01 01:99345900:00 2 1
2012-03-01 02:00:00 3 1
EXECUTE s1;
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
SET @x = 2;
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE @x = 1
UNION
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2;
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
EXECUTE s1;
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
SET @x = 1;
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE @x = 1
UNION
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2;
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
EXECUTE s1;
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DEALLOCATE PREPARE s1;
mysql-test/r/sp.result
View file @
05208258
...
@@ -7108,3 +7108,42 @@ DROP FUNCTION f1;
...
@@ -7108,3 +7108,42 @@ DROP FUNCTION f1;
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# -- End of 5.1 tests
# -- End of 5.1 tests
# ------------------------------------------------------------------
# ------------------------------------------------------------------
#
# LP bug#993459 Execution of PS for a query with GROUP BY
# returns wrong result (see also mysql bug#13805127)
#
CREATE PROCEDURE p1(x INT UNSIGNED)
BEGIN
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE x = 1
UNION
SELECT 2 FROM dual WHERE x = 1 OR x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2
;
END|
CALL p1(1);
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
CALL p1(2);
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
CALL p1(1);
c1 c2 count(c3)
2012-03-01 01:00:00 2 1
2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1
DROP PROCEDURE p1;
mysql-test/t/ps.test
View file @
05208258
...
@@ -3152,6 +3152,94 @@ execute st;
...
@@ -3152,6 +3152,94 @@ execute st;
show
status
like
'%Handler_read%'
;
show
status
like
'%Handler_read%'
;
deallocate
prepare
st
;
deallocate
prepare
st
;
drop
table
t1
;
drop
table
t1
;
--
echo
#
--
echo
# LP bug#993459 Execution of PS for a query with GROUP BY
--
echo
# returns wrong result (see also mysql bug#13805127)
--
echo
#
PREPARE
s1
FROM
"
SELECT c1, t2.c2, count(c3)
FROM
(
SELECT 3 as c2 FROM dual WHERE @x = 1
UNION
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
) AS t1,
(
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
UNION
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
UNION
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
) AS t2
WHERE t2.c2 = t1.c2
GROUP BY c1, c2
"
;
--
echo
SET
@
x
=
1
;
SELECT
c1
,
t2
.
c2
,
count
(
c3
)
FROM
(
SELECT
3
as
c2
FROM
dual
WHERE
@
x
=
1
UNION
SELECT
2
FROM
dual
WHERE
@
x
=
1
OR
@
x
=
2
)
AS
t1
,
(
SELECT
'2012-03-01 01:00:00'
AS
c1
,
3
as
c2
,
1
as
c3
FROM
dual
UNION
SELECT
'2012-03-01 02:00:00'
,
3
,
2
FROM
dual
UNION
SELECT
'2012-03-01 01:99345900:00'
,
2
,
1
FROM
dual
)
AS
t2
WHERE
t2
.
c2
=
t1
.
c2
GROUP
BY
c1
,
c2
;
--
echo
EXECUTE
s1
;
--
echo
SET
@
x
=
2
;
SELECT
c1
,
t2
.
c2
,
count
(
c3
)
FROM
(
SELECT
3
as
c2
FROM
dual
WHERE
@
x
=
1
UNION
SELECT
2
FROM
dual
WHERE
@
x
=
1
OR
@
x
=
2
)
AS
t1
,
(
SELECT
'2012-03-01 01:00:00'
AS
c1
,
3
as
c2
,
1
as
c3
FROM
dual
UNION
SELECT
'2012-03-01 02:00:00'
,
3
,
2
FROM
dual
UNION
SELECT
'2012-03-01 01:00:00'
,
2
,
1
FROM
dual
)
AS
t2
WHERE
t2
.
c2
=
t1
.
c2
GROUP
BY
c1
,
c2
;
--
echo
EXECUTE
s1
;
--
echo
SET
@
x
=
1
;
SELECT
c1
,
t2
.
c2
,
count
(
c3
)
FROM
(
SELECT
3
as
c2
FROM
dual
WHERE
@
x
=
1
UNION
SELECT
2
FROM
dual
WHERE
@
x
=
1
OR
@
x
=
2
)
AS
t1
,
(
SELECT
'2012-03-01 01:00:00'
AS
c1
,
3
as
c2
,
1
as
c3
FROM
dual
UNION
SELECT
'2012-03-01 02:00:00'
,
3
,
2
FROM
dual
UNION
SELECT
'2012-03-01 01:00:00'
,
2
,
1
FROM
dual
)
AS
t2
WHERE
t2
.
c2
=
t1
.
c2
GROUP
BY
c1
,
c2
;
--
echo
EXECUTE
s1
;
DEALLOCATE
PREPARE
s1
;
mysql-test/t/sp.test
View file @
05208258
...
@@ -8441,3 +8441,39 @@ DROP FUNCTION f1;
...
@@ -8441,3 +8441,39 @@ DROP FUNCTION f1;
--
echo
# ------------------------------------------------------------------
--
echo
# ------------------------------------------------------------------
--
echo
# -- End of 5.1 tests
--
echo
# -- End of 5.1 tests
--
echo
# ------------------------------------------------------------------
--
echo
# ------------------------------------------------------------------
--
echo
#
--
echo
# LP bug#993459 Execution of PS for a query with GROUP BY
--
echo
# returns wrong result (see also mysql bug#13805127)
--
echo
#
delimiter
|
;
CREATE
PROCEDURE
p1
(
x
INT
UNSIGNED
)
BEGIN
SELECT
c1
,
t2
.
c2
,
count
(
c3
)
FROM
(
SELECT
3
as
c2
FROM
dual
WHERE
x
=
1
UNION
SELECT
2
FROM
dual
WHERE
x
=
1
OR
x
=
2
)
AS
t1
,
(
SELECT
'2012-03-01 01:00:00'
AS
c1
,
3
as
c2
,
1
as
c3
FROM
dual
UNION
SELECT
'2012-03-01 02:00:00'
,
3
,
2
FROM
dual
UNION
SELECT
'2012-03-01 01:00:00'
,
2
,
1
FROM
dual
)
AS
t2
WHERE
t2
.
c2
=
t1
.
c2
GROUP
BY
c1
,
c2
;
END
|
delimiter
;
|
--
echo
CALL
p1
(
1
);
CALL
p1
(
2
);
CALL
p1
(
1
);
DROP
PROCEDURE
p1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment