简体   繁体   English

使用 psql 还原 PostgreSQL 转储时关系不存在

[英]Relation not exist using psqlto restore PostgreSQL dump

I tried to restore the following file to a database in PostgreSQL 9.我尝试将以下文件恢复到 PostgreSQL 9 中的数据库。

--
-- PostgreSQL database dump
--

-- Dumped from database version 9.5.10
-- Dumped by pg_dump version 9.5.10

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

SET search_path = xml, pg_catalog;

--
-- Data for Name: t_us_sir_flag; Type: TABLE DATA; Schema: xml; Owner: -
--

COPY t_us_sir_flag (us_sir_flag_id, publication_id, modified_load_id, status, content) FROM stdin;
\.


--
-- Name: t_us_sir_flag_us_sir_flag_id_seq; Type: SEQUENCE SET; Schema: xml; Owner: -
--

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


--
-- PostgreSQL database dump complete
--


Here is the code I usded along with the error information.这是我与错误信息一起使用的代码。 在此处输入图片说明

Can anyone please let me know how to fix this?任何人都可以让我知道如何解决这个问题吗? Thank you!谢谢!

Well, you need to create the table before you can COPY into it.好吧,您需要先创建表,然后才能将其COPY到其中。

Whoever created the dump file used the --data-only option of pg_dump , so that the table definition, constraints and indexes are not included in the dump.创建转储文件的人使用了pg_dump--data-only选项,因此转储中不包含表定义、约束和索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM