From 01523ead41c7bf6dddee6d682753ac518f2db122 Mon Sep 17 00:00:00 2001 From: Valeh Date: Sat, 21 Nov 2026 21:47:43 +0400 Subject: [PATCH 1/2] feat: add PostgreSQL 19 support to CI, Docker tests and docs --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/ci.yml | 8 ++++---- CHANGELOG.md | 5 +++++ CONTRIBUTING.md | 2 +- README.md | 2 +- docker-compose.yml | 14 ++++++++++++++ docs/ARCHITECTURE.md | 6 +++--- docs/TESTING.md | 22 +++++++++++----------- test/fixtures/seed.sql | 4 ++-- test/run_all.sh | 16 ++++++++-------- 10 files changed, 50 insertions(+), 31 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d11915c..0a6afdd 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7680e00..66db24f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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" @@ -405,7 +405,7 @@ jobs: strategy: fail-fast: false matrix: - pg_version: [14, 18] + pg_version: [14, 18, 19] services: sqlserver: @@ -496,7 +496,7 @@ jobs: strategy: fail-fast: false matrix: - pg_version: [14, 18] + pg_version: [14, 18, 19] steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b35b6..24fa6f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e2f23c..1a134ab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/README.md b/README.md index 55afc0c..498fa34 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index 55747e2..afcd66d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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). diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 7d86cab..11e292f 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -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 @@ -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+) diff --git a/docs/TESTING.md b/docs/TESTING.md index 88b5b2f..fc2c195 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/fixtures/seed.sql b/test/fixtures/seed.sql index 48dd7f4..458ff31 100644 --- a/test/fixtures/seed.sql +++ b/test/fixtures/seed.sql @@ -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, diff --git a/test/run_all.sh b/test/run_all.sh index d2b517f..12ba331 100755 --- a/test/run_all.sh +++ b/test/run_all.sh @@ -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 # ============================================================ @@ -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 From e3ceaccc9c473635a2c730b38b74434feee2f6fa Mon Sep 17 00:00:00 2001 From: Valeh Date: Sat, 21 Nov 2026 21:53:28 +0400 Subject: [PATCH 2/2] fix: include utils/lsyscache.h for get_database_name() on PG 19 --- src/pgclone.c | 3 +++ src/pgclone_diff.c | 3 +++ src/pgclone_preflight.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/pgclone.c b/src/pgclone.c index c2e222b..0780de9 100644 --- a/src/pgclone.c +++ b/src/pgclone.c @@ -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" diff --git a/src/pgclone_diff.c b/src/pgclone_diff.c index 933843d..69e4dd7 100644 --- a/src/pgclone_diff.c +++ b/src/pgclone_diff.c @@ -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. diff --git a/src/pgclone_preflight.c b/src/pgclone_preflight.c index 9e48551..30d708b 100644 --- a/src/pgclone_preflight.c +++ b/src/pgclone_preflight.c @@ -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