Sql 如何将表从转储恢复到数据库?

Sql 如何将表从转储恢复到数据库?,sql,postgresql,Sql,Postgresql,我使用pg_dump创建一个表转储: pg_dump -h server1 -U postgres -t np_points gisurfo > D:\np_point.sql 在我进入psql并说: -f D:\np_point.sql 但要获取标准PostgreSQL表的列表 接下来,我尝试在pgAdmin中验证np_point.sql并得到错误: ERROR: Syntax error (near: "1") LINE 78: 1 Сухово 75244822005 7564

我使用pg_dump创建一个表转储:

pg_dump -h server1 -U postgres -t np_points gisurfo > D:\np_point.sql
在我进入psql并说:

-f D:\np_point.sql
但要获取标准PostgreSQL表的列表

接下来,我尝试在pgAdmin中验证np_point.sql并得到错误:

ERROR:  Syntax error (near: "1")
LINE 78: 1 Сухово 75244822005 75644000 Челябинская обл. Нязепетровски...
COPY np_point (gid, full_name, okato, oktmo, obl_name, region_nam, the_geom) FROM stdin;
1   Сухово  75244822005 75644000    Челябинская обл.    Нязепетровский район    0101000020E6100000312A7936BD9F4D402A3C580DE9FF4B40
这是我得到错误的sql代码片段:

ERROR:  Syntax error (near: "1")
LINE 78: 1 Сухово 75244822005 75644000 Челябинская обл. Нязепетровски...
COPY np_point (gid, full_name, okato, oktmo, obl_name, region_nam, the_geom) FROM stdin;
1   Сухово  75244822005 75644000    Челябинская обл.    Нязепетровский район    0101000020E6100000312A7936BD9F4D402A3C580DE9FF4B40
如何从sql文件还原表

更新

PostgreSQL 8.4

和sql文件的第一部分

PostgreSQL database dump

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: np_point; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
 --

CREATE TABLE np_point (
gid integer NOT NULL,
full_name character varying(254),
okato character varying(254),
oktmo character varying(254),
obl_name character varying(254),
region_nam character varying(254),
the_geom geometry,
CONSTRAINT enforce_dims_the_geom CHECK ((st_ndims(the_geom) = 2)),
CONSTRAINT enforce_geotype_the_geom CHECK (((geometrytype(the_geom) = 'POINT'::text) OR (the_geom IS NULL))),
CONSTRAINT enforce_srid_the_geom CHECK ((st_srid(the_geom) = 4326))
);

您是否在数据库中安装了posgis?如果没有,请先安装postgis

如果安装postgis后仍然存在问题,请尝试转储没有几何体字段的表
并将其恢复到另一个数据库中,然后查看问题是否仍然出现

哪些版本的博士后?要从中转储和导入的数据库的属性是什么?您正在从中转储和导入的数据库的模式是什么样子的?@wich:我更新了这个问题。请看。这就是你想看到的?你在destinations db中安装了posgis吗?@francs:是的,当然是couse.pg_dump-h server1-E UTF8-U postgres-t“schemaname.np_points”gisurfo>D:\np_point.sql