Issues

ZF-8455: Problem Zend_Db_Adapter_Pdo_Pgsql::listTables()

Description

In query problem with the function pg_table_is_visible

zf 1.9.6


public function listTables()
{
    $sql = "SELECT c.relname  AS table_name "
          . "FROM pg_catalog.pg_class c "
          . "JOIN pg_catalog.pg_roles r ON r.oid = c.relowner "
          . "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace "
          . "WHERE n.nspname <> 'pg_catalog' "
          . "AND n.nspname !~ '^pg_toast' "
          . "AND pg_catalog.pg_table_is_visible(c.oid) "
          . "AND c.relkind = 'r' ";

    return $this->fetchCol($sql);
}

zf 1.9.5


public function listTables()
{
    // @todo use a better query with joins instead of subqueries
    $sql = "SELECT c.relname AS table_name "
         . "FROM pg_class c, pg_user u "
         . "WHERE c.relowner = u.usesysid AND c.relkind = 'r' "
         . "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) "
         . "AND c.relname !~ '^(pg_|sql_)' "
         . "UNION "
         . "SELECT c.relname AS table_name "
         . "FROM pg_class c "
         . "WHERE c.relkind = 'r' "
         . "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) "
         . "AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) "
         . "AND c.relname !~ '^pg_'";

    return $this->fetchCol($sql);
}

applied the patch ZF-8046

Comments

My fault, this commit wasn't suppose to be in branch but only in trunk that's why the "Fix Versions" field of ZF-8046 was "Next minor release" I will revert it ASAP.

Fixed with r19377