Menu

#431 (ok 3.1.3) Row count tooltip wrong for information_schema

closed-accepted
Interface (183)
1
2009-02-28
2008-11-29
No

Hi,

For information schema, the tooltips initially all display 0 rows, while phpmyadmin apparently doesn't know the row count.
After you've browsed a table, it displays the correct count for that table. It shouldn't display 0 if it doesn't know.

Discussion

  • Marc Delisle

    Marc Delisle - 2008-12-04
    • summary: Row count tooltip wrong --> Row count tooltip wrong for information_schema
     
  • Herman van Rink

    Herman van Rink - 2009-02-14

    The problem here is that MySQL returns NULL values for the row count when using a query like "show table status from `information_schema`;"

    We however have an alternate method of calculating the number of rows, which is already used for views.

    Below is a patch that uses this alternate method for both navigation.php and db_structure.php.

    Index: db_structure.php

    --- db_structure.php (revision 12236)
    +++ db_structure.php (working copy)
    @@ -288,6 +288,10 @@
    case 'ISAM' :
    case 'HEAP' :
    case 'MEMORY' :
    + if ($db_is_information_schema) {
    + $each_table['Rows'] = PMA_Table::countRecords($db, $each_table['Name'], $return = true);
    + }
    +
    if ($is_show_stats) {
    $tblsize = doubleval($each_table['Data_length']) + doubleval($each_table['Index_length']);
    $sum_size += $tblsize;
    Index: libraries/common.lib.php
    ===================================================================
    --- libraries/common.lib.php (revision 12236)
    +++ libraries/common.lib.php (working copy)
    @@ -744,6 +744,8 @@
    */
    function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = false)
    {
    + global $db_is_information_schema;
    + debug($db_is_information_schema, -2, '$db_is_information_schema');
    $sep = $GLOBALS['cfg']['LeftFrameTableSeparator'];

    if (null === $tables) {
    @@ -789,14 +791,14 @@
    // Do not check exact row count here,
    // if row count is invalid possibly the table is defect
    // and this would break left frame;
    - // but we can check row count if this is a view,
    + // but we can check row count if this is a view or the information_schema database,
    // since PMA_Table::countRecords() returns a limited row count
    // in this case.

    // set this because PMA_Table::countRecords() can use it
    $tbl_is_view = PMA_Table::isView($db, $table['Name']);

    - if ($tbl_is_view) {
    + if ($tbl_is_view || $db == 'information_schema') {
    $table['Rows'] = PMA_Table::countRecords($db, $table['Name'],
    $return = true);
    }

     
  • Herman van Rink

    Herman van Rink - 2009-02-14

    Hmm, I see that I was a bit too quick in adding that comment.

    The following 2 lines should be removed.
    + global $db_is_information_schema;
    + debug($db_is_information_schema, -2, '$db_is_information_schema');

    I had been looking into the possibility of re-using $db_is_information_schema in the PMA_getTableList function.

     
  • Marc Delisle

    Marc Delisle - 2009-02-16
    • labels: 317619 --> Interface
    • milestone: 896443 -->
     
  • Marc Delisle

    Marc Delisle - 2009-02-16

    Moved to patches

     
  • Marc Delisle

    Marc Delisle - 2009-02-16
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2009-02-16
    • priority: 5 --> 1
    • summary: Row count tooltip wrong for information_schema --> (ok 3.1.3) Row count tooltip wrong for information_schema
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2009-02-16

    Patch merged, thanks Herman. But I find a little curious that now for information_schema, on the main panel the type is reported as MEMORY for some "tables" and as "MyISAM" for others.

     
  • Herman van Rink

    Herman van Rink - 2009-02-16

    That difference in table type also made me look twice.

    However it is what the server returns when using the following query:
    show table status from `information_schema`;

     
  • Marc Delisle

    Marc Delisle - 2009-02-28
    • status: open-accepted --> closed-accepted
     
MongoDB Logo MongoDB