rdbms: define wasLockTimeout() for postgres
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabasePostgres.php
index 38cc4ae..49c945e 100644 (file)
@@ -413,13 +413,14 @@ class DatabasePostgres extends Database {
         * @param string $conds
         * @param string $fname
         * @param array $options
+        * @param array $join_conds
         * @return int
         */
        public function estimateRowCount( $table, $vars = '*', $conds = '',
-               $fname = __METHOD__, $options = []
+               $fname = __METHOD__, $options = [], $join_conds = []
        ) {
                $options['EXPLAIN'] = true;
-               $res = $this->select( $table, $vars, $conds, $fname, $options );
+               $res = $this->select( $table, $vars, $conds, $fname, $options, $join_conds );
                $rows = -1;
                if ( $res ) {
                        $row = $this->fetchRow( $res );
@@ -798,7 +799,13 @@ __INDEXATTR__;
        }
 
        public function wasDeadlock() {
-               return $this->lastErrno() == '40P01';
+               // https://www.postgresql.org/docs/8.2/static/errcodes-appendix.html
+               return $this->lastErrno() === '40P01';
+       }
+
+       public function wasLockTimeout() {
+               // https://www.postgresql.org/docs/8.2/static/errcodes-appendix.html
+               return $this->lastErrno() === '55P03';
        }
 
        public function duplicateTableStructure(