1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

A fix and test case for Bug#6088 "FOUND_ROWS returns wrong values for

prepared statements when LIMIT is used" and post-review comments.
The fix changes the approach we calculate the need for ORDER BY 
in UNION: the previous was not PS friendly, as it damaged SELECT_LEX 
options in case of single select.


mysql-test/r/ps.result:
  Test results fixed: the test case for Bug#6088
mysql-test/r/subselect.result:
  Test results fixed: now we don't perform ORDER BY for parts of UNION
  if there is no LIMIT clause.
mysql-test/t/ps.test:
  A test case for Bug#6088 "FOUND_ROWS returns wrong values for
   prepared statements when LIMIT is used".
sql/sql_union.cc:
  The actual fix for Bug#6088:
  - don't modify SELECT_LEX'es
  - use boolean variable can_skip_order_by to check if we can skip
    ORDER BY in UNION
This commit is contained in:
unknown
2004-10-22 22:51:16 +04:00
parent 1cd249e0ed
commit 9b5cf9464c
4 changed files with 54 additions and 18 deletions

View File

@ -410,3 +410,27 @@ a a
1.1 1.2
2.1 2.2
deallocate prepare stmt;
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
prepare stmt from "select sql_calc_found_rows * from t1 limit 2";
execute stmt;
a
1
2
select found_rows();
found_rows()
10
execute stmt;
a
1
2
select found_rows();
found_rows()
10
execute stmt;
a
1
2
select found_rows();
found_rows()
10