Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-86

limit in derived in subquery in a stored function

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • None
    • 5.5.20
    • None
    • None

    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.

      Attachments

        1. s1
          5 kB
        2. s2
          5 kB

        Issue Links

          Activity

            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.

            serg Sergei Golubchik added a comment - 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.

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

            igor Igor Babaev (Inactive) added a comment - Pushed the fix into lp:~maria-captains/maria/5.5

            People

              igor Igor Babaev (Inactive)
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.