diff --git a/libraries/parse_analyze.inc.php b/libraries/parse_analyze.inc.php index 25373ed0cd..5ce3ff5ff1 100644 --- a/libraries/parse_analyze.inc.php +++ b/libraries/parse_analyze.inc.php @@ -87,8 +87,7 @@ if ($GLOBALS['cfg']['RememberSorting'] } // checks whether a LIMIT clause should be added to the query -if (($_SESSION['tmp_user_values']['max_rows'] != 'all') - && ! ($is_count || $is_export || $is_func || $is_analyse) +if (! ($is_count || $is_export || $is_func || $is_analyse) && isset($analyzed_sql[0]['queryflags']['select_from']) && ! isset($analyzed_sql[0]['queryflags']['offset']) && empty($analyzed_sql[0]['limit_clause']) diff --git a/sql.php b/sql.php index 81fb8d5f56..28e1c4d468 100644 --- a/sql.php +++ b/sql.php @@ -319,7 +319,9 @@ if ($is_remember_sorting_order) { $sql_limit_to_append = ''; // Do append a "LIMIT" clause? -if ($is_append_limit_clause) { +if (($_SESSION['tmp_user_values']['max_rows'] != 'all') + && $is_append_limit_clause +) { $sql_limit_to_append = ' LIMIT ' . $_SESSION['tmp_user_values']['pos'] . ', ' . $_SESSION['tmp_user_values']['max_rows'] . " "; $full_sql_query = PMA_getSqlWithLimitClause(