public function saveOids($file, $overwrite = false)
    {
        $this->connect();
        $overwrite = file_exists($file) ? $overwrite : true;
        $result = pg_query($this->pgConn, 'select oid, typname from pg_type');
        if ($result === false) {
            throw $this->createException();
        }

        $this->oidTypeNames = [];
        while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) {
            $this->oidTypeNames[$row['oid']] = $row['typname'];
        }

        if ($overwrite) {
            $resultOids = [
                $this->host => [
                    $this->dbName => $this->oidTypeNames
                ]
            ];
        } else {
            $resultOids = include $file;
            if (isset($resultOids[$this->host][$this->dbName])) {
                $resultOids[$this->host][$this->dbName] = $this->oidTypeNames;
            }
        }
        $content =<<<'PHP'
<?php
//This file is automatically generated. Do not edit it.
return
PHP;
        $content .= ' ' . var_export($resultOids, true) . ';';

        file_put_contents($file, $content);
    }