通常我很幸运pg_dump获取表数据的转储,但由于某种原因,它总是为其中一个返回零行。
这是我使用的通常有效的命令
pg_dump -d foo_db -h localhost -p 8888 -U postgres -t foo_table --column-inserts --data-only > foo.sql
port,db,login都很好
结果如下:
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_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;
--
-- Data for Name: foo_table; Type: TABLE DATA; Schema: public; Owner: postgres
--
--
-- Name: foo_table_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('foo_table_id_seq', 179, true);
--
-- PostgreSQL database dump complete
--
我可以登录数据库并查看行中的行,但是pg_dump由于某种原因无法获取它们
psql -U postgres -h localhost -p 8888 -d foo_db
You are now connected to database "foo_db" as user "postgres".
foo_db=# select count(*) from foo_table;
count
-------
116
(1 row)
Time: 30.972 ms