Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Walk through what changed and why. For C changes, briefly note:
- [ ] `plan()` count exactly matches the actual number of assertions
- [ ] Shell tests added/updated in `test/test_async.sh` or `test/test_database_create.sh` (if applicable)
- [ ] `test/fixtures/seed.sql` updated if new test objects are needed
- [ ] CI is green on **all** of PG 14, 15, 16, 17, 18
- [ ] CI is green on **all** of PG 14, 15, 16, 17, 18, 19

```sh
# Output of pre_deploy_checks.sh (paste the summary line)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg_version: [14, 15, 16, 17, 18]
pg_version: [14, 15, 16, 17, 18, 19]

services:
source-db:
Expand Down Expand Up @@ -302,7 +302,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg_version: [14, 18]
pg_version: [14, 18, 19]

env:
IC_VERSION: "23.5.0.24.07"
Expand Down Expand Up @@ -405,7 +405,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg_version: [14, 18]
pg_version: [14, 18, 19]

services:
sqlserver:
Expand Down Expand Up @@ -496,7 +496,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pg_version: [14, 18]
pg_version: [14, 18, 19]

steps:
- name: Checkout
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to pgclone are documented in this file.

## [Unreleased]

### Added
- PostgreSQL 19 support: CI matrix (main, Oracle, SQL Server and MySQL jobs), `docker-compose.yml` (`test-pg19`), `test/run_all.sh` defaults, and docs now cover PostgreSQL 14-19. No C or SQL changes were needed (`src/` uses only version guards for PG 15 and PG 17).

## [4.9.0]

This release has no SQL-level changes; after `make install`, **restart PostgreSQL**, then `ALTER EXTENSION pgclone UPDATE`.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sudo make install PG_CONFIG=/usr/lib/postgresql/18/bin/pg_config

### Run Tests

pgclone uses Docker Compose to test across PostgreSQL 14–18:
pgclone uses Docker Compose to test across PostgreSQL 14–19:

```bash
# Run tests on PostgreSQL 17
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A PostgreSQL extension that clones databases, schemas, tables, and functions bet
- **Selective cloning** - filter columns and rows with `columns` and `WHERE` options
- **Full DDL support** - indexes, constraints (PK, UNIQUE, CHECK, FK, EXCLUDE), triggers, views, materialized views, sequences, generated columns
- **Conflict resolution** - error, skip, replace, or rename strategies
- **Cross-version** - tested on PostgreSQL 14, 15, 16, 17, and 18
- **Cross-version** - tested on PostgreSQL 14, 15, 16, 17, 18, and 19

## Quick Start

Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ services:
source-db:
condition: service_healthy

# Test on PostgreSQL 19
test-pg19:
build:
context: .
args:
PG_VERSION: "19"
environment:
POSTGRES_PASSWORD: testpass
POSTGRES_DB: target_db
SOURCE_CONNINFO: "host=source-db dbname=source_db user=postgres password=testpass"
depends_on:
source-db:
condition: service_healthy

# ---- Oracle -> PostgreSQL tests (pgclone.table_from_oracle) ----
# Oracle Free is published for x86-64 only; on Apple Silicon it runs under
# emulation (slow first start — enable Rosetta in Docker Desktop).
Expand Down
6 changes: 3 additions & 3 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ pgclone/
│ ├── test_sqlserver.sh # SQL Server integration test (needs SQL Server; run by CI job `sqlserver`)
│ ├── test_mysql.sh # MySQL integration test (needs MySQL; run by CI job `mysql`)
│ └── test_database_create.sh
├── .github/workflows/ci.yml # GitHub Actions CI (PG 14–18 matrix)
├── .github/workflows/ci.yml # GitHub Actions CI (PG 14–19 matrix)
├── Dockerfile # Multi-version build container
├── docker-compose.yml # Source + test containers (PG 14–18)
├── docker-compose.yml # Source + test containers (PG 14–19)
├── Makefile # PGXS-based build
├── pgclone.control # Extension metadata
├── META.json # PGXN metadata
Expand Down Expand Up @@ -261,7 +261,7 @@ typedef struct PgcloneSharedState {

## PostgreSQL Version Compatibility

pgclone uses C preprocessor guards to maintain compatibility across PG 14–18:
pgclone uses C preprocessor guards to maintain compatibility across PG 14–19:

### Shared Memory Request (PG 15+)

Expand Down
22 changes: 11 additions & 11 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PgClone Testing

PgClone has a comprehensive test suite that runs across PostgreSQL versions 14–18 using pgTAP, Docker Compose, and GitHub Actions CI.
PgClone has a comprehensive test suite that runs across PostgreSQL versions 14–19 using pgTAP, Docker Compose, and GitHub Actions CI.

## Test Suite Overview

Expand Down Expand Up @@ -93,12 +93,12 @@ Located in `test/test_oracle.sh`, seeded by `test/fixtures/oracle_seed.sql`. It
- a 20,000-row table (several COPY flushes)
- `include_data => false`, an existing target (never overwritten), a missing Oracle table and a wrong password (no leftover table)

The type-mapping function `pgclone.oracle_type_to_pg()` and the "built without Oracle" error path are additionally covered by pgTAP group 29 in `test/pgclone_test.sql`, which runs in the normal PG 14–18 matrix.
The type-mapping function `pgclone.oracle_type_to_pg()` and the "built without Oracle" error path are additionally covered by pgTAP group 29 in `test/pgclone_test.sql`, which runs in the normal PG 14–19 matrix.

#### Running it locally with Docker Compose

```bash
./test/run_all.sh oracle # PG 14, 17 and 18 against Oracle Free
./test/run_all.sh oracle # PG 14, 17, 18 and 19 against Oracle Free
./test/run_all.sh oracle 17 # a single PostgreSQL version

# or by hand
Expand Down Expand Up @@ -133,12 +133,12 @@ Located in `test/test_sqlserver.sh`, seeded by `test/fixtures/sqlserver_seed.sql
- a 20,000-row table (several COPY flushes)
- `include_data => false`, an existing target (never overwritten), a missing table and a wrong password (no leftover table)

The type-mapping function `pgclone.sqlserver_type_to_pg()` and the "built without SQL Server" error path are additionally covered by pgTAP group 30 in `test/pgclone_test.sql`, which runs in the normal PG 14–18 matrix.
The type-mapping function `pgclone.sqlserver_type_to_pg()` and the "built without SQL Server" error path are additionally covered by pgTAP group 30 in `test/pgclone_test.sql`, which runs in the normal PG 14–19 matrix.

#### Running it locally with Docker Compose

```bash
./test/run_all.sh sqlserver # PG 14, 17 and 18 against SQL Server 2022
./test/run_all.sh sqlserver # PG 14, 17, 18 and 19 against SQL Server 2022
./test/run_all.sh sqlserver 17 # a single PostgreSQL version

# or by hand
Expand Down Expand Up @@ -171,12 +171,12 @@ Located in `test/test_mysql.sh`, seeded by `test/fixtures/mysql_seed.sql`. It ne
- a 20,000-row table (several COPY flushes)
- `include_data => false`, an existing target (never overwritten), a missing table and a wrong password (no leftover table)

The type-mapping function `pgclone.mysql_type_to_pg()` and the "built without MySQL" error path are additionally covered by pgTAP group 31 in `test/pgclone_test.sql`, which runs in the normal PG 14–18 matrix.
The type-mapping function `pgclone.mysql_type_to_pg()` and the "built without MySQL" error path are additionally covered by pgTAP group 31 in `test/pgclone_test.sql`, which runs in the normal PG 14–19 matrix.

#### Running it locally with Docker Compose

```bash
./test/run_all.sh mysql # PG 14, 17 and 18 against MySQL 8.0
./test/run_all.sh mysql # PG 14, 17, 18 and 19 against MySQL 8.0
./test/run_all.sh mysql 17 # a single PostgreSQL version

# or by hand
Expand Down Expand Up @@ -271,19 +271,19 @@ The CI pipeline (`.github/workflows/ci.yml`) runs on every push to `main`, `fix/

### Matrix Strategy

Tests run in parallel across PostgreSQL 14, 15, 16, 17, and 18 with `fail-fast: false` — so a failure on one version doesn't cancel the others.
Tests run in parallel across PostgreSQL 14, 15, 16, 17, 18, and 19 with `fail-fast: false` — so a failure on one version doesn't cancel the others.

### Oracle job

A second job, `oracle`, runs on PostgreSQL 14 and 18. It starts the `gvenzl/oracle-free` service container, installs Oracle Instant Client (Basic Light + SDK + SQL*Plus), builds pgclone with `WITH_ORACLE=1`, seeds Oracle, starts a target PostgreSQL with `libclntsh` on its library path, and runs `test/test_oracle.sh`.
A second job, `oracle`, runs on PostgreSQL 14, 18 and 19. It starts the `gvenzl/oracle-free` service container, installs Oracle Instant Client (Basic Light + SDK + SQL*Plus), builds pgclone with `WITH_ORACLE=1`, seeds Oracle, starts a target PostgreSQL with `libclntsh` on its library path, and runs `test/test_oracle.sh`.

### SQL Server job

A third job, `sqlserver`, runs on PostgreSQL 14 and 18. It starts the `mcr.microsoft.com/mssql/server:2022-latest` service container, installs FreeTDS (`freetds-dev`, `freetds-bin`), builds pgclone with `WITH_SQLSERVER=1`, seeds SQL Server with `tsql`, starts a target PostgreSQL, and runs `test/test_sqlserver.sh`.
A third job, `sqlserver`, runs on PostgreSQL 14, 18 and 19. It starts the `mcr.microsoft.com/mssql/server:2022-latest` service container, installs FreeTDS (`freetds-dev`, `freetds-bin`), builds pgclone with `WITH_SQLSERVER=1`, seeds SQL Server with `tsql`, starts a target PostgreSQL, and runs `test/test_sqlserver.sh`.

### MySQL job

A fourth job, `mysql`, runs on PostgreSQL 14 and 18. It starts MySQL 8.0 with `docker run` (so it can pass `--default-authentication-plugin=mysql_native_password`), installs `libmariadb-dev` and the MariaDB client, builds pgclone with `WITH_MYSQL=1`, seeds MySQL, starts a target PostgreSQL, and runs `test/test_mysql.sh`.
A fourth job, `mysql`, runs on PostgreSQL 14, 18 and 19. It starts MySQL 8.0 with `docker run` (so it can pass `--default-authentication-plugin=mysql_native_password`), installs `libmariadb-dev` and the MariaDB client, builds pgclone with `WITH_MYSQL=1`, seeds MySQL, starts a target PostgreSQL, and runs `test/test_mysql.sh`.

### CI Steps

Expand Down
3 changes: 3 additions & 0 deletions src/pgclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "utils/syscache.h"
#include "utils/guc.h"
#include "commands/dbcommands.h"
#if PG_VERSION_NUM >= 190000
#include "utils/lsyscache.h" /* get_database_name() moved here in PG 19 */
#endif
#include "utils/jsonb.h"
#include "postmaster/bgworker.h"
#include "storage/ipc.h"
Expand Down
3 changes: 3 additions & 0 deletions src/pgclone_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include "miscadmin.h"
#include "utils/guc.h"
#include "commands/dbcommands.h"
#if PG_VERSION_NUM >= 190000
#include "utils/lsyscache.h" /* get_database_name() moved here in PG 19 */
#endif

/* ---------------------------------------------------------------
* Forward decls of local helpers borrowed in spirit from pgclone.c.
Expand Down
3 changes: 3 additions & 0 deletions src/pgclone_preflight.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "miscadmin.h"
#include "utils/guc.h"
#include "commands/dbcommands.h"
#if PG_VERSION_NUM >= 190000
#include "utils/lsyscache.h" /* get_database_name() moved here in PG 19 */
#endif

/* ===============================================================
* Connection / query helpers (self-contained — does not share
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,8 @@ INSERT INTO test_schema.customer_accounts (customer_name, bank_account_number, i

-- ============================================================
-- Generated columns (pgTAP test group 32). STORED is valid on
-- every supported server. VIRTUAL is PostgreSQL 18 only and is
-- not seeded here, because CI loads this file on PG 14–18.
-- every supported server. VIRTUAL is PostgreSQL 18+ only and is
-- not seeded here, because CI loads this file on PG 14–19.
-- ============================================================
CREATE TABLE test_schema.gen_test (
id int PRIMARY KEY,
Expand Down
16 changes: 8 additions & 8 deletions test/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#
# Usage:
# ./test/run_all.sh # Test on all PG versions
# ./test/run_all.sh 18 # Test on PG 18 only
# ./test/run_all.sh 19 # Test on PG 19 only
# ./test/run_all.sh 16 17 # Test on PG 16 and 17
# ./test/run_all.sh oracle # Oracle -> PostgreSQL tests (PG 14, 17, 18)
# ./test/run_all.sh oracle # Oracle -> PostgreSQL tests (PG 14, 17, 18, 19)
# ./test/run_all.sh oracle 17 # Oracle tests on PG 17 only
# ./test/run_all.sh sqlserver # SQL Server -> PostgreSQL tests (PG 14, 17, 18)
# ./test/run_all.sh sqlserver # SQL Server -> PostgreSQL tests (PG 14, 17, 18, 19)
# ./test/run_all.sh sqlserver 17 # SQL Server tests on PG 17 only
# ./test/run_all.sh mysql # MySQL -> PostgreSQL tests (PG 14, 17, 18)
# ./test/run_all.sh mysql # MySQL -> PostgreSQL tests (PG 14, 17, 18, 19)
# ./test/run_all.sh mysql 17 # MySQL tests on PG 17 only
# ============================================================

Expand All @@ -23,23 +23,23 @@ MODE="pg"
if [ "${1:-}" = "oracle" ]; then
MODE="oracle"
shift
DEFAULT_VERSIONS="14 17 18"
DEFAULT_VERSIONS="14 17 18 19"
DB_SERVICE="oracle-db"
SERVICE_PREFIX="test-oracle-pg"
elif [ "${1:-}" = "sqlserver" ]; then
MODE="sqlserver"
shift
DEFAULT_VERSIONS="14 17 18"
DEFAULT_VERSIONS="14 17 18 19"
DB_SERVICE="sqlserver-db"
SERVICE_PREFIX="test-sqlserver-pg"
elif [ "${1:-}" = "mysql" ]; then
MODE="mysql"
shift
DEFAULT_VERSIONS="14 17 18"
DEFAULT_VERSIONS="14 17 18 19"
DB_SERVICE="mysql-db"
SERVICE_PREFIX="test-mysql-pg"
else
DEFAULT_VERSIONS="14 15 16 17 18"
DEFAULT_VERSIONS="14 15 16 17 18 19"
DB_SERVICE="source-db"
SERVICE_PREFIX="test-pg"
fi
Expand Down
Loading