protected function getSchemaSearchPath() {
        $options = $this->options;
        $path = null;

        while ($this->hConnection) {
            try {
                $result = pg_query($this->hConnection, 'show search_path');
                $row    = pg_fetch_array($result, null, PGSQL_NUM);
                $path   = $row[0];

                if (strContains($path, '"$user"') && isset($options['user'])) {
                    $path = str_replace('"$user"', $options['user'], $path);
                }
                break;
            }
            catch (\Exception $ex) {
                if (strContainsI($ex->getMessage(), 'current transaction is aborted, commands ignored until end of transaction block')) {
                    if ($this->transactionLevel > 0) {
                        $this->transactionLevel = 1;            // immediately skip nested transactions
                        $this->rollback();
                        continue;
                    }
                }
                throw $ex;
            }
        }
        return $path;
    }