Pregunta

I have a schema named 2sample.sc. When I want to pg_dump some of its table, the following error appears:

pg_dump: No matching tables were found

My pg_dump command:

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

My pg_dump works fine on other schemas like 2sample.

What I did:

  • I tried to escape dot(.) with no success though
¿Fue útil?

Solución

Use "schema.name.with.dots.in.it"."table.name.with.dots.in.it" to specify the 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

Output (snipped):

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

BTW: why would you want to add a dot to a schema (or table) name? It is asking for trouble. The same for MixedCaseNames. Underscores work just fine.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top