ALH*_*ALH 3 postgresql schema pg-dump
我有一个名为 的架构2sample.sc
。当我想 pg_dump 它的一些表时,出现以下错误:
pg_dump: No matching tables were found
Run Code Online (Sandbox Code Playgroud)
我的 pg_dump 命令:
pg_dump -U postgres -t 2sample.sc."error_log" --inserts games > dump.sql
Run Code Online (Sandbox Code Playgroud)
我的 pg_dump 在其他模式(如 2sample)上运行良好。
我做了什么:
用于"schema.name.with.dots.in.it"."table.name.with.dots.in.it"
指定schema.table
:
-- test schema with a dot in its name
DROP SCHEMA "tmp.tmp" CASCADE;
CREATE SCHEMA "tmp.tmp" ;
SET search_path="tmp.tmp";
CREATE TABLE nononono
( dont SERIAL NOT NULL
);
insert into nononono
SELECT generate_series(1,10)
;
Run Code Online (Sandbox Code Playgroud)
$pg_dump -t \"tmp.tmp\".\"nononono\" --schema-only -U postgres the_database
Run Code Online (Sandbox Code Playgroud)
输出(截图):
SET search_path = "tmp.tmp", pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: nononono; Type: TABLE; Schema: tmp.tmp; Owner: postgres; Tablespace:
--
CREATE TABLE nononono (
dont integer NOT NULL
);
Run Code Online (Sandbox Code Playgroud)
顺便说一句:为什么要在架构(或表)名称中添加点?这是自找麻烦。对于混合大小写名称也是如此。下划线工作得很好。