private function dbRollback()
    {
        $res = null;
        if (!$this->isInDbTransaction()) {
            return $res;
        }

        $this->dbTransLevel--;

        if ($this->dbTransLevel == 0) {
            $res = pg_query($this->pgConn, 'rollback');
        } elseif ($this->dbTransLevel > 0) {
            $res = pg_query(
                $this->pgConn,
                'rollback to level' . $this->dbTransLevel . 'begin'
            );
        }

        if ($res === false) {
            throw $this->createException();
        }

        return $res;
    }