X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Fdatabase%2FDatabasePostgres.php;h=c945c35e5e622f0c6fe9ad8bff63ead00848acad;hb=d395dfb039fce787c9e4acbfeecbfe0ec372a9be;hp=38cc4aec60d9e7cb732e760a5d79a998b0b9dd48;hpb=0c2687f44eb0e8c7f480b7303f89056682ba0bfb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php index 38cc4aec60..c945c35e5e 100644 --- a/includes/libs/rdbms/database/DatabasePostgres.php +++ b/includes/libs/rdbms/database/DatabasePostgres.php @@ -409,17 +409,24 @@ class DatabasePostgres extends Database { * Takes same arguments as Database::select() * * @param string $table - * @param string $vars + * @param string $var * @param string $conds * @param string $fname * @param array $options + * @param array $join_conds * @return int */ - public function estimateRowCount( $table, $vars = '*', $conds = '', - $fname = __METHOD__, $options = [] + public function estimateRowCount( $table, $var = '*', $conds = '', + $fname = __METHOD__, $options = [], $join_conds = [] ) { + $conds = $this->normalizeConditions( $conds, $fname ); + $column = $this->extractSingleFieldFromList( $var ); + if ( is_string( $column ) && !in_array( $column, [ '*', '1' ] ) ) { + $conds[] = "$column IS NOT NULL"; + } + $options['EXPLAIN'] = true; - $res = $this->select( $table, $vars, $conds, $fname, $options ); + $res = $this->select( $table, $var, $conds, $fname, $options, $join_conds ); $rows = -1; if ( $res ) { $row = $this->fetchRow( $res );