Thread: pg_dump ,pg_restore problem

pg_dump ,pg_restore problem

From
Martin Ruff
Date:
Hi,
I dump a table and then try to restore and get the error message
[archiever] input file does not appear to be a valid archive

what I do:
pg_dump -d -f reportingdump -t holidaycalendar reporting

this results in the following dump file(some data removed)
--
-- PostgreSQL database dump
--

\connect - mruff

SET search_path = public, pg_catalog;

--
-- TOC entry 2 (OID 17149)
-- Name: holidaycalendar; Type: TABLE; Schema: public; Owner: mruff
--

CREATE TABLE holidaycalendar (
    id serial NOT NULL,
    holidaydate date NOT NULL,
    holidayhours numeric(2,0) NOT NULL,
    description character varying(1000) NOT NULL
);


--
-- Data for TOC entry 6 (OID 17149)
-- Name: holidaycalendar; Type: TABLE DATA; Schema: public; Owner: mruff
--

INSERT INTO holidaycalendar VALUES (1, '1999-01-01', 8, 'Neujahr');
INSERT INTO holidaycalendar VALUES (3, '1999-01-02', 8, 'Berchtoldstag');
...
--
-- TOC entry 5 (OID 17152)
-- Name: holidaycalendar_pkey; Type: CONSTRAINT; Schema: public; Owner: mruff
--

ALTER TABLE ONLY holidaycalendar
    ADD CONSTRAINT holidaycalendar_pkey PRIMARY KEY (id);


--
-- TOC entry 4 (OID 17154)
-- Name: holidaycalendar_holidaydate_key; Type: CONSTRAINT; Schema:
public; Owner: mruff
--

ALTER TABLE ONLY holidaycalendar
    ADD CONSTRAINT holidaycalendar_holidaydate_key UNIQUE (holidaydate);


--
-- TOC entry 3 (OID 17147)
-- Name: holidaycalendar_id_seq; Type: SEQUENCE SET; Schema: public;
Owner: mruff
--

SELECT pg_catalog.setval ('holidaycalendar_id_seq', 1, false);


then I try to restore:
pg_restore -a reportingdump  -d reporting -t holidaycalendar
and get the error:
[archiever] input file does not appear to be a valid archive

thanks for help



-------------------------------------------
Be the change you want to see in the world.



Re: pg_dump ,pg_restore problem

From
Tom Lane
Date:
Martin Ruff <mruff@simeon.ch> writes:
> I dump a table and then try to restore and get the error message
> [archiever] input file does not appear to be a valid archive

The default output from pg_dump is a script that you feed to psql.
pg_restore is only used for -Fc or -Ft dumps.

            regards, tom lane