我遇到了一个转储文件的问题,客户端给我一个文件来连接php中的postgres数据库,我首先这样做。
我的ssdf_master.dump的特征是\N和。当在navicat中运行该文件时,显示以下错误:
[Err] ERROR: error de sintaxis en o cerca de «01»
LINE 784: 01 Aguascalientes AGS 00000 99999 \N文件提取
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'LATIN1';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--
CREATE PROCEDURAL LANGUAGE plpgsql;
ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: scg; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--
CREATE TABLE scg (
base_datos character varying(8),
ip character varying(15),
tipo character(1),
owner character varying(8),
own_passwd character varying(8)
);
ALTER TABLE public.scg OWNER TO postgres;
--
-- Data for Name: scg; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY scg (base_datos, ip, tipo, owner, own_passwd) FROM stdin;
SCGDGCA 10.18.20.150 E postgres postgres
SCGSJ 10.18.20.150 E postgres postgres
SCGDPRE 10.18.20.150 E postgres postgres
SCGDSSA 10.18.20.150 E postgres postgres
SCGDAFI 10.18.20.150 E postgres postgres
SCGSDA 10.18.20.150 E postgres postgres
SCGDPRED 10.18.20.150 E postgres postgres
\.注意:以前,我创建了一个名为postgres的数据库,其用户postgres不带pasword。
我希望我已经解释了!
发布于 2013-03-26 19:24:33
根据文件的摘录,这是一个纯文本格式的转储。
不应该将它传递给pg_restore,因为:
pg_restore是一种实用工具,用于从pg_dump(1)创建的非纯文本格式的存档中恢复PostgreSQL数据库。
相反,当连接到已经创建的数据库(大概是空的)时,它应该直接输入到psql。这些对象似乎属于postgres,因此应该这样做:
psql -U postgres -d yourdbname < dumpfilehttps://stackoverflow.com/questions/15633165
复制相似问题