pgclone
pgclone : Clone PostgreSQL databases, schemas, tables, and functions across environments
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9590 | pgclone | pgclone | 3.6.0 | ETL | PostgreSQL | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| See Also | db_migrator pglogical repmgr pgactive |
shared_preload_libraries = pgclone is required for async/progress features; synchronous clone functions work without it.
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.6.0 | 18 17 16 15 14 | pgclone | - |
| RPM | PIGSTY | 3.6.0 | 18 17 16 15 14 | pgclone_$v | - |
| DEB | PIGSTY | 3.6.0 | 18 17 16 15 14 | postgresql-$v-pgclone | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
el8.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
el9.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
el9.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
el10.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
el10.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
d12.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
d12.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
d13.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
d13.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
u22.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
u22.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
u24.x86_64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
u24.aarch64 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 | PIGSTY 3.6.0 |
Source
pig build pkg pgclone; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pgclone; # install via package name, for the active PG version
pig install pgclone -v 18; # install for PG 18
pig install pgclone -v 17; # install for PG 17
pig install pgclone -v 16; # install for PG 16
pig install pgclone -v 15; # install for PG 15
pig install pgclone -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pgclone';Create this extension with:
CREATE EXTENSION pgclone;Usage
Syntax:
CREATE EXTENSION pgclone; SELECT pgclone_table('host=source-server dbname=mydb user=postgres password=secret', 'public', 'customers', true);Sources: README, Usage Guide
pgclone clones PostgreSQL databases, schemas, tables, functions, roles, and permissions directly from SQL. The upstream README emphasizes that it uses PostgreSQL’s COPY protocol and avoids external pg_dump / pg_restore workflows.
Core Capabilities
The README lists support for:
- cloning tables, schemas, functions, and full databases
- indexes, constraints, triggers, views, materialized views, and sequences
- selective cloning with column selection and
WHEREfilters - conflict handling with error, skip, replace, or rename strategies
- data masking and sensitive-column discovery
- async and parallel cloning with background workers
Basic Functions
SELECT pgclone_table(
'host=source-server dbname=mydb user=postgres password=secret',
'public', 'customers', true
);
SELECT pgclone_schema(
'host=source-server dbname=mydb user=postgres password=secret',
'sales', true
);
SELECT pgclone_database(
'host=source-server dbname=mydb user=postgres password=secret',
true
);The README also documents pgclone_version() for verification after installation.
Async Mode
For background-worker features, the extension must be preloaded:
shared_preload_libraries = 'pgclone'The upstream docs describe async operations, progress tracking, and multi-worker parallel cloning in separate documentation pages.
Requirements
Current upstream requirements are:
- PostgreSQL 14 or newer
- PostgreSQL development headers
libpqdevelopment library- a C compiler such as GCC
The repository homepage is postgresql.az, and the project README links separate documents for usage, async operations, testing, and architecture.