[MDEV-86] limit in derived in subquery in a stored function Created: 2012-01-16  Updated: 2012-01-19  Resolved: 2012-01-19

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.5.20

Type: Bug Priority: Critical
Reporter: Sergei Golubchik Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Attachments: File s1     File s2    
Issue Links:
Blocks
blocks MDEV-31 make buildbot green for 5.5 Closed

 Description   

in sp.test:

create function f1(p1 integer, p2 integer)
returns int
begin
  declare count int;
  set count= (select count(*) from (select * from t1 limit p1, p2) t_1);
  return count;
end|
select f1(0, -1)|

limit values are used in JOIN::optimize invoked from mysql_derived_optimize.
While limit values are set in st_select_lex_unit::set_limit invoked from mysql_derived_fill invoked from mysql_derived_optimize. Later in the execute flow.
Full stack traces are attached.



 Comments   
Comment by Sergei Golubchik [ 2012-01-16 ]

please review also the complete changeset that added this test case to sp.test.
It looks questionable to me. But it's unrelated to the bug.

Comment by Igor Babaev [ 2012-01-18 ]

Pushed the fix into lp:~maria-captains/maria/5.5

Generated at Thu Feb 08 06:26:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.