Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PostgreSQL备份和恢复_Postgresql_Postgis - Fatal编程技术网

PostgreSQL备份和恢复

PostgreSQL备份和恢复,postgresql,postgis,Postgresql,Postgis,我在恢复PostgreSQL备份时遇到问题 在我自己的计算机上,我使用自定义备份格式转储一个表 在服务器上,我尝试还原该文件,但它给了我几个错误: pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 247; 1259 147321 TABLE county postgres pg_restore: [archiver (db)] coul

我在恢复PostgreSQL备份时遇到问题

在我自己的计算机上,我使用自定义备份格式转储一个表

在服务器上,我尝试还原该文件,但它给了我几个错误:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 247; 1259 147321 TABLE county postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geometry" does not exist
这就是我在服务器上所做的:

pSql -U postgres
/c justice
CREATE EXTENSION postgis;

pg_restore -p 5432 -U postgres -d justice data_import
我正在两台计算机上运行PostgreSQL 9.3.2。但是,我在本地计算机上安装了PostGIS 2.1.1,在服务器上安装了PostGIS 2.0.4。这可能是个问题吗

为什么我的PostGIS扩展无法在服务器上工作

当我没有指定数据库时,它似乎可以工作。然而,数据去了哪里?它还将所有SQL语句写入屏幕

pg_restore -p 5432 -U postgres public_county
PostgreSQL database dump complete
当我试图验证PostGIS的安装时,它给了我一个错误。我认为扩展可能安装不正确:

select PostGIS_full_version();
ERROR:  function postgis_full_version() does not exist

如果不指定数据库,
pg_restore
将转储文件提取为SQL格式并打印到标准输出。所以它并不是真的“去”任何地方。这是一种将自定义格式转储转换为SQL格式转储的方法。这部分解决了我的问题。现在我必须弄清楚它为什么不能识别我的postgis扩展。我是否可以创建一个不包含任何功能的postgis扩展?这看起来像是“在错误的数据库中创建扩展”或“错误的搜索路径”问题。这是我的搜索路径:“$user”,public,用户可能是“postgres”。