pgclone
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pgclone | 3.6.0 | ETL | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9590 | pgclone | No | Yes | Yes | Yes | No | No | - |
| Related | db_migrator pglogical repmgr pgactive |
|---|
shared_preload_libraries = pgclone is required for async/progress features; synchronous clone functions work without it.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.6.0 | 1817161514 | pgclone | - |
| RPM | PIGSTY | 3.6.0 | 1817161514 | pgclone_$v | - |
| DEB | PIGSTY | 3.6.0 | 1817161514 | postgresql-$v-pgclone | - |
Build
You can build the RPM / DEB packages for pgclone using pig build:
pig build pkg pgclone # build RPM / DEB packages
Install
You can install pgclone directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pgclone; # Install for current active PG version
pig ext install -y pgclone -v 18 # PG 18
pig ext install -y pgclone -v 17 # PG 17
pig ext install -y pgclone -v 16 # PG 16
pig ext install -y pgclone -v 15 # PG 15
pig ext install -y pgclone -v 14 # PG 14
dnf install -y pgclone_18 # PG 18
dnf install -y pgclone_17 # PG 17
dnf install -y pgclone_16 # PG 16
dnf install -y pgclone_15 # PG 15
dnf install -y pgclone_14 # PG 14
apt install -y postgresql-18-pgclone # PG 18
apt install -y postgresql-17-pgclone # PG 17
apt install -y postgresql-16-pgclone # PG 16
apt install -y postgresql-15-pgclone # PG 15
apt install -y postgresql-14-pgclone # PG 14
Preload:
shared_preload_libraries = 'pgclone';
Create Extension:
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.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.