3

我有一个名为2sample.sc. 当我想pg_dump它的一些表时,会出现以下错误:

pg_dump: No matching tables were found

我的 pg_dump 命令:

pg_dump -U postgres -t 2sample.sc."error_log" --inserts games > dump.sql

我的 pg_dump 在 2sample 等其他模式上运行良好。

我做了什么:

  • 我试图逃脱点(。)但没有成功
4

1 回答 1

4

用于"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)
        ;

$pg_dump -t \"tmp.tmp\".\"nononono\" --schema-only -U postgres the_database

输出(剪断):

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
);

顺便说一句:为什么要在模式(或表)名称中添加一个点?这是自找麻烦。MixedCaseNames 也是如此。下划线工作得很好。

于 2013-12-26T12:12:10.590 回答