sql - How to restore table from dump to database? -


i create table dump using pg_dump:

pg_dump -h server1 -u postgres -t np_points gisurfo > d:\np_point.sql 

after go in psql , says:

-f d:\np_point.sql 

but list of standart postgresql tables.

next try exequte np_point.sql in pgadmin , error:

error:  syntax error (near: "1") line 78: 1 Сухово 75244822005 75644000 Челябинская обл. Нязепетровски... 

its snippet of sql error:

copy np_point (gid, full_name, okato, oktmo, obl_name, region_nam, the_geom) stdin; 1   Сухово  75244822005 75644000    Челябинская обл.    Нязепетровский район    0101000020e6100000312a7936bd9f4d402a3c580de9ff4b40 

how can restore table sql file?

update

postgresql 8.4

and first part of sql file.

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 null))), constraint enforce_srid_the_geom check ((st_srid(the_geom) = 4326)) ); 

did install posgis in destinations db? if not , install postgis first。

if install postgis , still have problem, try dump table without geometry filed , restore in db ,and see if problem still appears.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

Decoding a Python 2 `tempfile` with python-future -