Menu

#3539 (ok 3.5.1)Limit clause ignored when sort order is remembered

3.5.0
fixed
1
2013-06-11
2012-03-24
No

Steps to reproduce:
Enable remember sort order feature and make PMA remember the sort order for a particular table. Browse the table and then edit the usual browse table query to add a limit clause. The added limit clause is ignored.

Discussion

  • Madhura Jayaratne

    To be fixed in version 3.5.1

    Proposed fix is
    diff --git a/libraries/common.lib.php b/libraries/common.lib.php
    index e35f405..f40f61b 100644
    --- a/libraries/common.lib.php
    +++ b/libraries/common.lib.php
    @@ -1120,6 +1120,7 @@ function PMA_showMessage($message, $sql_query = null, $type = 'notice', $is_view
    ) {
    $query_base = $analyzed_display_query[0]['section_before_limit']
    . "\n" . $GLOBALS['sql_order_to_append']
    + . $analyzed_display_query[0]['limit_clause'] . ' '
    . $analyzed_display_query[0]['section_after_limit'];

    // Need to reparse query
    diff --git a/sql.php b/sql.php
    index 432fb14..952d7eb 100644
    --- a/sql.php
    +++ b/sql.php
    @@ -467,7 +467,7 @@ if ($GLOBALS['cfg']['RememberSorting']
    // retrieve the remembered sorting order for current table
    $sql_order_to_append = ' ORDER BY ' . $sorted_col . ' ';
    $full_sql_query = $analyzed_sql[0]['section_before_limit'] . $sql_order_to_append
    - . $analyzed_sql[0]['section_after_limit'];
    + . $analyzed_sql[0]['limit_clause'] . ' ' . $analyzed_sql[0]['section_after_limit'];

    // update the $analyzed_sql
    $analyzed_sql[0]['section_before_limit'] .= $sql_order_to_append;

     
  • Madhura Jayaratne

    This bug was fixed in repository and will be part of a future release; thanks for reporting.

     
  • Madhura Jayaratne

    • labels: --> Data insertion/extraction/manipulation
    • priority: 5 --> 1
    • summary: Limit clause ignored when sort order is remembered --> (ok 3.5.1)Limit clause ignored when sort order is remembered
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2012-05-07
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed