Skip to content

Uppercase schema name not escaped correctly #942

@mk-na

Description

@mk-na

pgcopydb version: v0.17

Description

pgcopydb clone does not work correctly with uppercase schema names when using --filters flag.


Issue

Case 1: Unquoted Uppercase Schema

filters.ini:

[include-only-schema]
UPPERCASE-SCHEMA
12:06:34.089 389251 INFO   STEP 2: dump the source database schema (pre/post data)
12:06:34.091 389251 INFO    /usr/bin/pg_dump -Fc --snapshot 00000004-00000004-1 --section=pre-data --section=post-data --schema UPPERCASE-SCHEMA --file ./storage/cache/schema/schema.dump 'postgres://postgres@localhost:5432/postgres?keepalives=1&keepalives_idle=10&keepalives_interval=10&keepalives_count=60'
12:06:34.146 389251 ERROR  pg_dump: error: no matching schemas were found
12:06:34.148 389251 ERROR  Failed to run pg_dump: exit code 1
12:06:34.148 389251 ERROR  Failed to clone source database, see above for details
12:06:34.167 389249 ERROR  clone process 389251 has terminated [6]

Case 2: Quoted Uppercase Schema

filters.ini:

[include-only-schema]
"UPPERCASE-SCHEMA"

Result:
pgcopydb clone completes, but only the schema itself is created - none of its objects (tables, indexes, etc.) are copied.

Case 3: Unquoted Lowercase Schema

filters.ini:

[include-only-schema]
lowercase-schema

Result:
Works as expected.

Expected Behavior

I believe the issue is that pgcopydb does not properly escape uppercase schema names when passing them to pg_dump.
Schema argument should be escaped as:

pg_dump ... --schema "\"UPPERCASE-SCHEMA\""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions