Reputation: 7700
I have a problem with a dump file that client give me to make a file to connect with postgres database in php, and I do this first
My ssdf_master.dump has characteres like \N and . and when run that file in navicat display this error:
[Err] ERROR: error de sintaxis en o cerca de «01»
LINE 784: 01 Aguascalientes AGS 00000 99999 \N
Extract of file
--
-- 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
\.
Note: Previously, I create a database called postgres with user postgres without pasword.
I hope I have explained!
Upvotes: 0
Views: 6944
Reputation: 61676
According to the extract of the file, this is a dump in plain text format.
It should not to be passed to pg_restore because:
pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump(1) in one of the non-plain-text formats
Rather it should be fed directly to psql
when connected to an already created database, presumably empty. The objects seem to be owned by postgres
, so this should do:
psql -U postgres -d yourdbname < dumpfile
Upvotes: 2