From 2762e23e54b76a5b0237ca593bac2aaf16c99a58 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Sun, 18 May 2025 21:05:03 -0400 Subject: [PATCH 01/11] feat: pg_partman all major versions --- nix/ext/pg_partman.nix | 2 +- nix/tests/expected/z_15_ext_interface.out | 3 ++- nix/tests/expected/z_17_ext_interface.out | 3 ++- nix/tests/expected/z_orioledb-17_ext_interface.out | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/nix/ext/pg_partman.nix b/nix/ext/pg_partman.nix index 08fc74cee..bee226601 100644 --- a/nix/ext/pg_partman.nix +++ b/nix/ext/pg_partman.nix @@ -7,7 +7,7 @@ stdenv.mkDerivation rec { pname = "pg_partman"; - version = "5.1.0"; + version = "5.2.4"; buildInputs = [ postgresql ]; diff --git a/nix/tests/expected/z_15_ext_interface.out b/nix/tests/expected/z_15_ext_interface.out index a0db07837..88e36b15e 100644 --- a/nix/tests/expected/z_15_ext_interface.out +++ b/nix/tests/expected/z_15_ext_interface.out @@ -30,9 +30,10 @@ order by name ----------------- pg_cron + pg_partman pgjwt tsm_system_time -(3 rows) +(4 rows) /* diff --git a/nix/tests/expected/z_17_ext_interface.out b/nix/tests/expected/z_17_ext_interface.out index 6a7b4a16c..845bb25ac 100644 --- a/nix/tests/expected/z_17_ext_interface.out +++ b/nix/tests/expected/z_17_ext_interface.out @@ -23,10 +23,11 @@ order by name ------------------------ pg_cron + pg_partman pgjwt postgis_tiger_geocoder tsm_system_time -(4 rows) +(5 rows) /* diff --git a/nix/tests/expected/z_orioledb-17_ext_interface.out b/nix/tests/expected/z_orioledb-17_ext_interface.out index 6a7b4a16c..845bb25ac 100644 --- a/nix/tests/expected/z_orioledb-17_ext_interface.out +++ b/nix/tests/expected/z_orioledb-17_ext_interface.out @@ -23,10 +23,11 @@ order by name ------------------------ pg_cron + pg_partman pgjwt postgis_tiger_geocoder tsm_system_time -(4 rows) +(5 rows) /* From 79dcada9535fc9393472d4c80f1fce2ad58db82b Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 22 Oct 2025 16:48:39 -0400 Subject: [PATCH 02/11] wip: stage pg_partman multi-version changes --- nix/ext/pg_partman.nix | 112 ++++++++++++++++++++++++++++++-------- nix/ext/versions.json | 10 ++++ nix/packages/postgres.nix | 1 + 3 files changed, 101 insertions(+), 22 deletions(-) diff --git a/nix/ext/pg_partman.nix b/nix/ext/pg_partman.nix index bee226601..d178d16e6 100644 --- a/nix/ext/pg_partman.nix +++ b/nix/ext/pg_partman.nix @@ -1,38 +1,106 @@ { + pkgs, lib, stdenv, fetchFromGitHub, postgresql, + makeWrapper, + switch-ext-version, }: -stdenv.mkDerivation rec { +let pname = "pg_partman"; - version = "5.2.4"; + build = + version: hash: + stdenv.mkDerivation rec { + inherit pname version; - buildInputs = [ postgresql ]; + buildInputs = [ postgresql ]; + + src = fetchFromGitHub { + owner = "pgpartman"; + repo = pname; + rev = "refs/tags/v${version}"; + inherit hash; + }; + + installPhase = '' + mkdir -p $out/{lib,share/postgresql/extension} + + # Install versioned library + install -Dm755 src/*${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix} + + # Only install SQL files for the latest version + if [[ "${version}" == "${latestVersion}" ]]; then + # Install all SQL files from sql/ directory + cp -r sql/* $out/share/postgresql/extension/ + + # Install upgrade scripts + cp updates/* $out/share/postgresql/extension/ + fi + + # Create versioned control file with modified module path + sed -e "/^default_version =/d" \ + -e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}'|" \ + ${pname}.control > $out/share/postgresql/extension/${pname}--${version}.control + ''; + + meta = with lib; { + description = "Partition management extension for PostgreSQL"; + homepage = "https://github.com/pgpartman/pg_partman"; + changelog = "https://github.com/pgpartman/pg_partman/blob/v${version}/CHANGELOG.md"; + platforms = postgresql.meta.platforms; + license = licenses.postgresql; + }; + }; + allVersions = (builtins.fromJSON (builtins.readFile ./versions.json)).pg_partman; + supportedVersions = lib.filterAttrs ( + _: value: builtins.elem (lib.versions.major postgresql.version) value.postgresql + ) allVersions; + versions = lib.naturalSort (lib.attrNames supportedVersions); + latestVersion = lib.last versions; + numberOfVersions = builtins.length versions; + packages = builtins.attrValues ( + lib.mapAttrs (name: value: build name value.hash) supportedVersions + ); +in +pkgs.buildEnv { + name = pname; + paths = packages; + nativeBuildInputs = [ makeWrapper ]; + + pathsToLink = [ + "/lib" + "/share/postgresql/extension" + ]; + + postBuild = '' + { + echo "default_version = '${latestVersion}'" + cat $out/share/postgresql/extension/${pname}--${latestVersion}.control + } > $out/share/postgresql/extension/${pname}.control + ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} - src = fetchFromGitHub { - owner = "pgpartman"; - repo = pname; - rev = "refs/tags/v${version}"; - sha256 = "sha256-GrVOJ5ywZMyqyDroYDLdKkXDdIJSDGhDfveO/ZvrmYs="; - }; - installPhase = '' - mkdir -p $out/{lib,share/postgresql/extension} + # checks + (set -x + test "$(ls -A $out/lib/${pname}*${postgresql.dlSuffix} | wc -l)" = "${ + toString (numberOfVersions + 1) + }" + ) - cp src/*${postgresql.dlSuffix} $out/lib - cp updates/* $out/share/postgresql/extension - cp -r sql/* $out/share/postgresql/extension - cp *.control $out/share/postgresql/extension + makeWrapper ${lib.getExe switch-ext-version} $out/bin/switch_pg_partman_version \ + --prefix EXT_WRAPPER : "$out" --prefix EXT_NAME : "${pname}" ''; - meta = with lib; { - description = "Partition management extension for PostgreSQL"; - homepage = "https://github.com/pgpartman/pg_partman"; - changelog = "https://github.com/pgpartman/pg_partman/blob/v${version}/CHANGELOG.md"; - platforms = postgresql.meta.platforms; - license = licenses.postgresql; - broken = versionOlder postgresql.version "14"; + passthru = { + inherit versions numberOfVersions switch-ext-version; + pname = "${pname}-all"; + hasBackgroundWorker = true; + defaultSettings = { + shared_preload_libraries = [ "pg_partman_bgw" ]; + }; + version = + "multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions); }; } diff --git a/nix/ext/versions.json b/nix/ext/versions.json index 701acb206..f65218fd5 100644 --- a/nix/ext/versions.json +++ b/nix/ext/versions.json @@ -320,6 +320,16 @@ ], "hash": "sha256-Cpi2iASi1QJoED0Qs1dANqg/BNZTsz5S+pw8iYyW03Y=" } + }, + "pg_partman": { + "5.2.4": { + "postgresql": [ + "15", + "17", + "orioledb-17" + ], + "hash": "sha256-i/o+JZEXnJRO17kfdTw87aca28+I8pvuFZsPMA/kf+w=" + } }, "pgmq": { "1.4.4": { diff --git a/nix/packages/postgres.nix b/nix/packages/postgres.nix index 576e82730..cb5eb922a 100644 --- a/nix/packages/postgres.nix +++ b/nix/packages/postgres.nix @@ -36,6 +36,7 @@ ../ext/pg_graphql ../ext/pg_stat_monitor.nix ../ext/pg_jsonschema + ../ext/pg_partman.nix ../ext/pgvector.nix ../ext/vault.nix ../ext/hypopg.nix From 94d9957189da5799f2d33bc6b0ddff56fb11bf70 Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:13:05 +0300 Subject: [PATCH 03/11] add tests for pg_partman --- migrations/schema.sql | 6 ++++++ nix/tests/expected/pg_partman.out | 0 nix/tests/sql/pg_partman.sql | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 nix/tests/expected/pg_partman.out create mode 100644 nix/tests/sql/pg_partman.sql diff --git a/migrations/schema.sql b/migrations/schema.sql index cb031f797..65e720224 100644 --- a/migrations/schema.sql +++ b/migrations/schema.sql @@ -78,6 +78,12 @@ CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; +-- +-- Name: pg_partman; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE SCHEMA partman; +CREATE EXTENSION pg_partman SCHEMA partman; -- -- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - diff --git a/nix/tests/expected/pg_partman.out b/nix/tests/expected/pg_partman.out new file mode 100644 index 000000000..e69de29bb diff --git a/nix/tests/sql/pg_partman.sql b/nix/tests/sql/pg_partman.sql new file mode 100644 index 000000000..bb018460d --- /dev/null +++ b/nix/tests/sql/pg_partman.sql @@ -0,0 +1,20 @@ +CREATE SCHEMA IF NOT EXISTS partman_test; + +CREATE TABLE partman_test.time_taptest_table + (col1 int, + col2 text default 'stuff', + col3 timestamptz NOT NULL DEFAULT now()) +PARTITION BY RANGE (col3); + +CREATE INDEX ON partman_test.time_taptest_table (col3); + +CREATE TABLE partman_test.time_taptest_table_template (LIKE partman_test.time_taptest_table); + +ALTER TABLE partman_test.time_taptest_table_template ADD PRIMARY KEY (col1); + +SELECT partman.create_parent( + p_parent_table := 'partman_test.time_taptest_table' + , p_control := 'col3' + , p_interval := '1 day' + , p_template_table := 'partman_test.time_taptest_table_template' +); From d5285a13d7cf17c51946a70f3534f926a0fd53e3 Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:13:05 +0300 Subject: [PATCH 04/11] add tests for pg_partman --- migrations/schema-15.sql | 3 + migrations/tests/extensions/30-pg_partman.sql | 4 + migrations/tests/extensions/test.sql | 1 + nix/tests/expected/z_15_ext_interface.out | 132 +++++++++++++++--- 4 files changed, 117 insertions(+), 23 deletions(-) create mode 100644 migrations/tests/extensions/30-pg_partman.sql diff --git a/migrations/schema-15.sql b/migrations/schema-15.sql index 1f1d98496..65c53004b 100644 --- a/migrations/schema-15.sql +++ b/migrations/schema-15.sql @@ -87,6 +87,9 @@ CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; +CREATE SCHEMA partman; +CREATE EXTENSION IF NOT EXISTS pg_partman WITH SCHEMA partman; + -- -- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - diff --git a/migrations/tests/extensions/30-pg_partman.sql b/migrations/tests/extensions/30-pg_partman.sql new file mode 100644 index 000000000..ad4ef6d72 --- /dev/null +++ b/migrations/tests/extensions/30-pg_partman.sql @@ -0,0 +1,4 @@ +BEGIN; +create schema if not exists "partman"; +create extension if not exists pg_partman with schema "partman"; +ROLLBACK; diff --git a/migrations/tests/extensions/test.sql b/migrations/tests/extensions/test.sql index 7e0d1f38d..1d7075c13 100644 --- a/migrations/tests/extensions/test.sql +++ b/migrations/tests/extensions/test.sql @@ -28,3 +28,4 @@ \ir 27-pg_repack.sql \ir 28-pgvector.sql \ir 29-pg_tle.sql +\ir 30-pg_partman.sql diff --git a/nix/tests/expected/z_15_ext_interface.out b/nix/tests/expected/z_15_ext_interface.out index 88e36b15e..c98547058 100644 --- a/nix/tests/expected/z_15_ext_interface.out +++ b/nix/tests/expected/z_15_ext_interface.out @@ -30,10 +30,9 @@ order by name ----------------- pg_cron - pg_partman pgjwt tsm_system_time -(4 rows) +(3 rows) /* @@ -85,6 +84,7 @@ order by pg_hashids | t pg_jsonschema | f pg_net | f + pg_partman | f pg_prewarm | t pg_repack | f pg_stat_monitor | t @@ -129,7 +129,7 @@ order by vector | t wrappers | t xml2 | f -(79 rows) +(80 rows) /* @@ -169,8 +169,8 @@ order by n.nspname, p.proname, md5(pg_catalog.pg_get_function_identity_arguments(p.oid)); - extension_name | schema_name | function_name | argument_types | return_type -------------------------+--------------------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + extension_name | schema_name | function_name | argument_types | return_type +------------------------+--------------------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ address_standardizer | public | parse_address | text, OUT num text, OUT street text, OUT street2 text, OUT address1 text, OUT city text, OUT state text, OUT zip text, OUT zipplus text, OUT country text | record address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, address text | stdaddr address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, micro text, macro text | stdaddr @@ -1168,6 +1168,47 @@ order by pg_net | net | wait_until_running | | void pg_net | net | wake | | void pg_net | net | worker_restart | | boolean + pg_partman | partman | apply_cluster | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text | void + pg_partman | partman | apply_constraints | p_parent_table text, p_child_table text, p_analyze boolean, p_job_id bigint | void + pg_partman | partman | apply_privileges | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text, p_job_id bigint | void + pg_partman | partman | autovacuum_off | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | autovacuum_reset | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | calculate_time_partition_info | p_time_interval interval, p_start_time timestamp with time zone, p_date_trunc_interval text, OUT base_timestamp timestamp with time zone, OUT datetime_string text | record + pg_partman | partman | check_automatic_maintenance_value | p_automatic_maintenance text | boolean + pg_partman | partman | check_control_type | p_parent_schema text, p_parent_tablename text, p_control text | TABLE(general_type text, exact_type text) + pg_partman | partman | check_default | p_exact_count boolean | SETOF partman.check_default_table + pg_partman | partman | check_epoch_type | p_type text | boolean + pg_partman | partman | check_name_length | p_object_name text, p_suffix text, p_table_partition boolean | text + pg_partman | partman | check_partition_type | p_type text | boolean + pg_partman | partman | check_subpart_sameconfig | p_parent_table text | TABLE(sub_control text, sub_partition_interval text, sub_partition_type text, sub_premake integer, sub_automatic_maintenance text, sub_template_table text, sub_retention text, sub_retention_schema text, sub_retention_keep_index boolean, sub_retention_keep_table boolean, sub_epoch text, sub_constraint_cols text[], sub_optimize_constraint integer, sub_infinite_time_partitions boolean, sub_jobmon boolean, sub_inherit_privileges boolean, sub_constraint_valid boolean, sub_date_trunc_interval text, sub_ignore_default_data boolean, sub_default_table boolean, sub_maintenance_order integer, sub_retention_keep_publication boolean, sub_control_not_null boolean) + pg_partman | partman | check_subpartition_limits | p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text | record + pg_partman | partman | create_parent | p_parent_table text, p_control text, p_interval text, p_type text, p_epoch text, p_premake integer, p_start_partition text, p_default_table boolean, p_automatic_maintenance text, p_constraint_cols text[], p_template_table text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | create_partition_id | p_parent_table text, p_partition_ids bigint[], p_start_partition text | boolean + pg_partman | partman | create_partition_time | p_parent_table text, p_partition_times timestamp with time zone[], p_start_partition text | boolean + pg_partman | partman | create_sub_parent | p_top_parent text, p_control text, p_interval text, p_type text, p_default_table boolean, p_declarative_check text, p_constraint_cols text[], p_premake integer, p_start_partition text, p_epoch text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | drop_constraints | p_parent_table text, p_child_table text, p_debug boolean | void + pg_partman | partman | drop_partition_id | p_parent_table text, p_retention bigint, p_keep_table boolean, p_keep_index boolean, p_retention_schema text | integer + pg_partman | partman | drop_partition_time | p_parent_table text, p_retention interval, p_keep_table boolean, p_keep_index boolean, p_retention_schema text, p_reference_timestamp timestamp with time zone | integer + pg_partman | partman | dump_partitioned_table_definition | p_parent_table text, p_ignore_template_table boolean | text + pg_partman | partman | inherit_replica_identity | p_parent_schemaname text, p_parent_tablename text, p_child_tablename text | void + pg_partman | partman | inherit_template_properties | p_parent_table text, p_child_schema text, p_child_tablename text | boolean + pg_partman | partman | partition_data_id | p_parent_table text, p_batch_count integer, p_batch_interval bigint, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_data_proc | IN p_parent_table text, IN p_loop_count integer, IN p_interval text, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_order text, IN p_source_table text, IN p_ignored_columns text[], IN p_quiet boolean | + pg_partman | partman | partition_data_time | p_parent_table text, p_batch_count integer, p_batch_interval interval, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_gap_fill | p_parent_table text | integer + pg_partman | partman | reapply_constraints_proc | IN p_parent_table text, IN p_drop_constraints boolean, IN p_apply_constraints boolean, IN p_wait integer, IN p_dryrun boolean | + pg_partman | partman | reapply_privileges | p_parent_table text | void + pg_partman | partman | run_analyze | IN p_skip_locked boolean, IN p_quiet boolean, IN p_parent_table text | + pg_partman | partman | run_maintenance | p_parent_table text, p_analyze boolean, p_jobmon boolean | void + pg_partman | partman | run_maintenance_proc | IN p_wait integer, IN p_analyze boolean, IN p_jobmon boolean | + pg_partman | partman | show_partition_info | p_child_table text, p_partition_interval text, p_parent_table text, OUT child_start_time timestamp with time zone, OUT child_end_time timestamp with time zone, OUT child_start_id bigint, OUT child_end_id bigint, OUT suffix text | record + pg_partman | partman | show_partition_name | p_parent_table text, p_value text, OUT partition_schema text, OUT partition_table text, OUT suffix_timestamp timestamp with time zone, OUT suffix_id bigint, OUT table_exists boolean | record + pg_partman | partman | show_partitions | p_parent_table text, p_order text, p_include_default boolean | TABLE(partition_schemaname text, partition_tablename text) + pg_partman | partman | stop_sub_partition | p_parent_table text, p_jobmon boolean | boolean + pg_partman | partman | undo_partition | p_parent_table text, p_target_table text, p_loop_count integer, p_batch_interval text, p_keep_table boolean, p_lock_wait numeric, p_ignored_columns text[], p_drop_cascade boolean, OUT partitions_undone integer, OUT rows_undone bigint | record + pg_partman | partman | undo_partition_proc | IN p_parent_table text, IN p_target_table text, IN p_loop_count integer, IN p_interval text, IN p_keep_table boolean, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_ignored_columns text[], IN p_drop_cascade boolean, IN p_quiet boolean | + pg_partman | partman | uuid7_time_decoder | uuidv7 text | timestamp with time zone + pg_partman | partman | uuid7_time_encoder | ts timestamp with time zone | uuid pg_prewarm | public | autoprewarm_dump_now | | bigint pg_prewarm | public | autoprewarm_start_worker | | void pg_prewarm | public | pg_prewarm | regclass, mode text, fork text, first_block bigint, last_block bigint | bigint @@ -1321,7 +1362,6 @@ order by pgcrypto | extensions | pgp_sym_encrypt_bytea | bytea, text, text | bytea pgmq | pgmq | _belongs_to_pgmq | table_name text | boolean pgmq | pgmq | _ensure_pg_partman_installed | | void - pgmq | pgmq | _extension_exists | extension_name text | boolean pgmq | pgmq | _get_partition_col | partition_interval text | text pgmq | pgmq | _get_pg_partman_major_version | | integer pgmq | pgmq | _get_pg_partman_schema | | text @@ -1335,7 +1375,6 @@ order by pgmq | pgmq | delete | queue_name text, msg_id bigint | boolean pgmq | pgmq | delete | queue_name text, msg_ids bigint[] | SETOF bigint pgmq | pgmq | detach_archive | queue_name text | void - pgmq | pgmq | drop_queue | queue_name text, partitioned boolean | boolean pgmq | pgmq | drop_queue | queue_name text | boolean pgmq | pgmq | format_table_name | queue_name text, prefix text | text pgmq | pgmq | list_queues | | SETOF pgmq.queue_record @@ -1343,19 +1382,9 @@ order by pgmq | pgmq | metrics_all | | SETOF pgmq.metrics_result pgmq | pgmq | pop | queue_name text | SETOF pgmq.message_record pgmq | pgmq | purge_queue | queue_name text | bigint - pgmq | pgmq | read | queue_name text, vt integer, qty integer, conditional jsonb | SETOF pgmq.message_record - pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer, conditional jsonb | SETOF pgmq.message_record - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb | SETOF bigint + pgmq | pgmq | read | queue_name text, vt integer, qty integer | SETOF pgmq.message_record + pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer | SETOF pgmq.message_record pgmq | pgmq | send | queue_name text, msg jsonb, delay integer | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay integer | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[] | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay integer | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[] | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay timestamp with time zone | SETOF bigint pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay integer | SETOF bigint pgmq | pgmq | set_vt | queue_name text, msg_id bigint, vt integer | SETOF pgmq.message_record pgmq | pgmq | validate_queue_name | queue_name text | void @@ -5242,7 +5271,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(5071 rows) +(5100 rows) /* @@ -5325,6 +5354,65 @@ order by pg_net | net | http_request_queue | method pg_net | net | http_request_queue | timeout_milliseconds pg_net | net | http_request_queue | url + pg_partman | partman | part_config | automatic_maintenance + pg_partman | partman | part_config | constraint_cols + pg_partman | partman | part_config | constraint_valid + pg_partman | partman | part_config | control + pg_partman | partman | part_config | date_trunc_interval + pg_partman | partman | part_config | datetime_string + pg_partman | partman | part_config | epoch + pg_partman | partman | part_config | ignore_default_data + pg_partman | partman | part_config | infinite_time_partitions + pg_partman | partman | part_config | inherit_privileges + pg_partman | partman | part_config | jobmon + pg_partman | partman | part_config | maintenance_last_run + pg_partman | partman | part_config | maintenance_order + pg_partman | partman | part_config | optimize_constraint + pg_partman | partman | part_config | parent_table + pg_partman | partman | part_config | partition_interval + pg_partman | partman | part_config | partition_type + pg_partman | partman | part_config | premake + pg_partman | partman | part_config | retention + pg_partman | partman | part_config | retention_keep_index + pg_partman | partman | part_config | retention_keep_publication + pg_partman | partman | part_config | retention_keep_table + pg_partman | partman | part_config | retention_schema + pg_partman | partman | part_config | sub_partition_set_full + pg_partman | partman | part_config | template_table + pg_partman | partman | part_config | time_decoder + pg_partman | partman | part_config | time_encoder + pg_partman | partman | part_config | undo_in_progress + pg_partman | partman | part_config_sub | sub_automatic_maintenance + pg_partman | partman | part_config_sub | sub_constraint_cols + pg_partman | partman | part_config_sub | sub_constraint_valid + pg_partman | partman | part_config_sub | sub_control + pg_partman | partman | part_config_sub | sub_control_not_null + pg_partman | partman | part_config_sub | sub_date_trunc_interval + pg_partman | partman | part_config_sub | sub_default_table + pg_partman | partman | part_config_sub | sub_epoch + pg_partman | partman | part_config_sub | sub_ignore_default_data + pg_partman | partman | part_config_sub | sub_infinite_time_partitions + pg_partman | partman | part_config_sub | sub_inherit_privileges + pg_partman | partman | part_config_sub | sub_jobmon + pg_partman | partman | part_config_sub | sub_maintenance_order + pg_partman | partman | part_config_sub | sub_optimize_constraint + pg_partman | partman | part_config_sub | sub_parent + pg_partman | partman | part_config_sub | sub_partition_interval + pg_partman | partman | part_config_sub | sub_partition_type + pg_partman | partman | part_config_sub | sub_premake + pg_partman | partman | part_config_sub | sub_retention + pg_partman | partman | part_config_sub | sub_retention_keep_index + pg_partman | partman | part_config_sub | sub_retention_keep_publication + pg_partman | partman | part_config_sub | sub_retention_keep_table + pg_partman | partman | part_config_sub | sub_retention_schema + pg_partman | partman | part_config_sub | sub_template_table + pg_partman | partman | part_config_sub | sub_time_decoder + pg_partman | partman | part_config_sub | sub_time_encoder + pg_partman | partman | table_privs | grantee + pg_partman | partman | table_privs | grantor + pg_partman | partman | table_privs | privilege_type + pg_partman | partman | table_privs | table_name + pg_partman | partman | table_privs | table_schema pg_repack | repack | primary_keys | indexrelid pg_repack | repack | primary_keys | indrelid pg_repack | repack | tables | alter_col_storage @@ -5467,7 +5555,6 @@ order by pg_tle | pgtle | feature_info | schema_name pgmq | pgmq | a_foo | archived_at pgmq | pgmq | a_foo | enqueued_at - pgmq | pgmq | a_foo | headers pgmq | pgmq | a_foo | message pgmq | pgmq | a_foo | msg_id pgmq | pgmq | a_foo | read_ct @@ -5477,7 +5564,6 @@ order by pgmq | pgmq | meta | is_unlogged pgmq | pgmq | meta | queue_name pgmq | pgmq | q_foo | enqueued_at - pgmq | pgmq | q_foo | headers pgmq | pgmq | q_foo | message pgmq | pgmq | q_foo | msg_id pgmq | pgmq | q_foo | read_ct @@ -6384,5 +6470,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(1108 rows) +(1165 rows) From 4e28a464e753db6dedc5e20687b198cdb23f3d9e Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Wed, 15 Oct 2025 20:36:37 +0300 Subject: [PATCH 05/11] add partman to local tests. remove from initial schema --- nix/tests/expected/pg_partman.out | 20 ++++ nix/tests/expected/z_17_ext_interface.out | 136 ++++++++++++++++++---- nix/tests/prime.sql | 2 + 3 files changed, 133 insertions(+), 25 deletions(-) diff --git a/nix/tests/expected/pg_partman.out b/nix/tests/expected/pg_partman.out index e69de29bb..b32e64bba 100644 --- a/nix/tests/expected/pg_partman.out +++ b/nix/tests/expected/pg_partman.out @@ -0,0 +1,20 @@ +CREATE SCHEMA IF NOT EXISTS partman_test; +CREATE TABLE partman_test.time_taptest_table + (col1 int, + col2 text default 'stuff', + col3 timestamptz NOT NULL DEFAULT now()) +PARTITION BY RANGE (col3); +CREATE INDEX ON partman_test.time_taptest_table (col3); +CREATE TABLE partman_test.time_taptest_table_template (LIKE partman_test.time_taptest_table); +ALTER TABLE partman_test.time_taptest_table_template ADD PRIMARY KEY (col1); +SELECT partman.create_parent( + p_parent_table := 'partman_test.time_taptest_table' + , p_control := 'col3' + , p_interval := '1 day' + , p_template_table := 'partman_test.time_taptest_table_template' +); + create_parent +--------------- + t +(1 row) + diff --git a/nix/tests/expected/z_17_ext_interface.out b/nix/tests/expected/z_17_ext_interface.out index 845bb25ac..96baed46f 100644 --- a/nix/tests/expected/z_17_ext_interface.out +++ b/nix/tests/expected/z_17_ext_interface.out @@ -23,11 +23,10 @@ order by name ------------------------ pg_cron - pg_partman pgjwt postgis_tiger_geocoder tsm_system_time -(5 rows) +(4 rows) /* @@ -77,6 +76,7 @@ order by pg_hashids | t pg_jsonschema | f pg_net | f + pg_partman | f pg_prewarm | t pg_repack | f pg_stat_monitor | t @@ -116,7 +116,7 @@ order by vector | t wrappers | t xml2 | f -(72 rows) +(73 rows) /* @@ -156,8 +156,8 @@ order by n.nspname, p.proname, md5(pg_catalog.pg_get_function_identity_arguments(p.oid)); - extension_name | schema_name | function_name | argument_types | return_type -----------------------+----------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + extension_name | schema_name | function_name | argument_types | return_type +----------------------+----------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ address_standardizer | public | parse_address | text, OUT num text, OUT street text, OUT street2 text, OUT address1 text, OUT city text, OUT state text, OUT zip text, OUT zipplus text, OUT country text | record address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, address text | stdaddr address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, micro text, macro text | stdaddr @@ -1153,6 +1153,47 @@ order by pg_net | net | wait_until_running | | void pg_net | net | wake | | void pg_net | net | worker_restart | | boolean + pg_partman | partman | apply_cluster | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text | void + pg_partman | partman | apply_constraints | p_parent_table text, p_child_table text, p_analyze boolean, p_job_id bigint | void + pg_partman | partman | apply_privileges | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text, p_job_id bigint | void + pg_partman | partman | autovacuum_off | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | autovacuum_reset | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | calculate_time_partition_info | p_time_interval interval, p_start_time timestamp with time zone, p_date_trunc_interval text, OUT base_timestamp timestamp with time zone, OUT datetime_string text | record + pg_partman | partman | check_automatic_maintenance_value | p_automatic_maintenance text | boolean + pg_partman | partman | check_control_type | p_parent_schema text, p_parent_tablename text, p_control text | TABLE(general_type text, exact_type text) + pg_partman | partman | check_default | p_exact_count boolean | SETOF partman.check_default_table + pg_partman | partman | check_epoch_type | p_type text | boolean + pg_partman | partman | check_name_length | p_object_name text, p_suffix text, p_table_partition boolean | text + pg_partman | partman | check_partition_type | p_type text | boolean + pg_partman | partman | check_subpart_sameconfig | p_parent_table text | TABLE(sub_control text, sub_partition_interval text, sub_partition_type text, sub_premake integer, sub_automatic_maintenance text, sub_template_table text, sub_retention text, sub_retention_schema text, sub_retention_keep_index boolean, sub_retention_keep_table boolean, sub_epoch text, sub_constraint_cols text[], sub_optimize_constraint integer, sub_infinite_time_partitions boolean, sub_jobmon boolean, sub_inherit_privileges boolean, sub_constraint_valid boolean, sub_date_trunc_interval text, sub_ignore_default_data boolean, sub_default_table boolean, sub_maintenance_order integer, sub_retention_keep_publication boolean, sub_control_not_null boolean) + pg_partman | partman | check_subpartition_limits | p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text | record + pg_partman | partman | create_parent | p_parent_table text, p_control text, p_interval text, p_type text, p_epoch text, p_premake integer, p_start_partition text, p_default_table boolean, p_automatic_maintenance text, p_constraint_cols text[], p_template_table text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | create_partition_id | p_parent_table text, p_partition_ids bigint[], p_start_partition text | boolean + pg_partman | partman | create_partition_time | p_parent_table text, p_partition_times timestamp with time zone[], p_start_partition text | boolean + pg_partman | partman | create_sub_parent | p_top_parent text, p_control text, p_interval text, p_type text, p_default_table boolean, p_declarative_check text, p_constraint_cols text[], p_premake integer, p_start_partition text, p_epoch text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | drop_constraints | p_parent_table text, p_child_table text, p_debug boolean | void + pg_partman | partman | drop_partition_id | p_parent_table text, p_retention bigint, p_keep_table boolean, p_keep_index boolean, p_retention_schema text | integer + pg_partman | partman | drop_partition_time | p_parent_table text, p_retention interval, p_keep_table boolean, p_keep_index boolean, p_retention_schema text, p_reference_timestamp timestamp with time zone | integer + pg_partman | partman | dump_partitioned_table_definition | p_parent_table text, p_ignore_template_table boolean | text + pg_partman | partman | inherit_replica_identity | p_parent_schemaname text, p_parent_tablename text, p_child_tablename text | void + pg_partman | partman | inherit_template_properties | p_parent_table text, p_child_schema text, p_child_tablename text | boolean + pg_partman | partman | partition_data_id | p_parent_table text, p_batch_count integer, p_batch_interval bigint, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_data_proc | IN p_parent_table text, IN p_loop_count integer, IN p_interval text, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_order text, IN p_source_table text, IN p_ignored_columns text[], IN p_quiet boolean | + pg_partman | partman | partition_data_time | p_parent_table text, p_batch_count integer, p_batch_interval interval, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_gap_fill | p_parent_table text | integer + pg_partman | partman | reapply_constraints_proc | IN p_parent_table text, IN p_drop_constraints boolean, IN p_apply_constraints boolean, IN p_wait integer, IN p_dryrun boolean | + pg_partman | partman | reapply_privileges | p_parent_table text | void + pg_partman | partman | run_analyze | IN p_skip_locked boolean, IN p_quiet boolean, IN p_parent_table text | + pg_partman | partman | run_maintenance | p_parent_table text, p_analyze boolean, p_jobmon boolean | void + pg_partman | partman | run_maintenance_proc | IN p_wait integer, IN p_analyze boolean, IN p_jobmon boolean | + pg_partman | partman | show_partition_info | p_child_table text, p_partition_interval text, p_parent_table text, OUT child_start_time timestamp with time zone, OUT child_end_time timestamp with time zone, OUT child_start_id bigint, OUT child_end_id bigint, OUT suffix text | record + pg_partman | partman | show_partition_name | p_parent_table text, p_value text, OUT partition_schema text, OUT partition_table text, OUT suffix_timestamp timestamp with time zone, OUT suffix_id bigint, OUT table_exists boolean | record + pg_partman | partman | show_partitions | p_parent_table text, p_order text, p_include_default boolean | TABLE(partition_schemaname text, partition_tablename text) + pg_partman | partman | stop_sub_partition | p_parent_table text, p_jobmon boolean | boolean + pg_partman | partman | undo_partition | p_parent_table text, p_target_table text, p_loop_count integer, p_batch_interval text, p_keep_table boolean, p_lock_wait numeric, p_ignored_columns text[], p_drop_cascade boolean, OUT partitions_undone integer, OUT rows_undone bigint | record + pg_partman | partman | undo_partition_proc | IN p_parent_table text, IN p_target_table text, IN p_loop_count integer, IN p_interval text, IN p_keep_table boolean, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_ignored_columns text[], IN p_drop_cascade boolean, IN p_quiet boolean | + pg_partman | partman | uuid7_time_decoder | uuidv7 text | timestamp with time zone + pg_partman | partman | uuid7_time_encoder | ts timestamp with time zone | uuid pg_prewarm | public | autoprewarm_dump_now | | bigint pg_prewarm | public | autoprewarm_start_worker | | void pg_prewarm | public | pg_prewarm | regclass, mode text, fork text, first_block bigint, last_block bigint | bigint @@ -1306,7 +1347,6 @@ order by pgcrypto | extensions | pgp_sym_encrypt_bytea | bytea, text, text | bytea pgmq | pgmq | _belongs_to_pgmq | table_name text | boolean pgmq | pgmq | _ensure_pg_partman_installed | | void - pgmq | pgmq | _extension_exists | extension_name text | boolean pgmq | pgmq | _get_partition_col | partition_interval text | text pgmq | pgmq | _get_pg_partman_major_version | | integer pgmq | pgmq | _get_pg_partman_schema | | text @@ -1320,7 +1360,6 @@ order by pgmq | pgmq | delete | queue_name text, msg_id bigint | boolean pgmq | pgmq | delete | queue_name text, msg_ids bigint[] | SETOF bigint pgmq | pgmq | detach_archive | queue_name text | void - pgmq | pgmq | drop_queue | queue_name text, partitioned boolean | boolean pgmq | pgmq | drop_queue | queue_name text | boolean pgmq | pgmq | format_table_name | queue_name text, prefix text | text pgmq | pgmq | list_queues | | SETOF pgmq.queue_record @@ -1328,19 +1367,9 @@ order by pgmq | pgmq | metrics_all | | SETOF pgmq.metrics_result pgmq | pgmq | pop | queue_name text | SETOF pgmq.message_record pgmq | pgmq | purge_queue | queue_name text | bigint - pgmq | pgmq | read | queue_name text, vt integer, qty integer, conditional jsonb | SETOF pgmq.message_record - pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer, conditional jsonb | SETOF pgmq.message_record - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb | SETOF bigint + pgmq | pgmq | read | queue_name text, vt integer, qty integer | SETOF pgmq.message_record + pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer | SETOF pgmq.message_record pgmq | pgmq | send | queue_name text, msg jsonb, delay integer | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay integer | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb | SETOF bigint - pgmq | pgmq | send | queue_name text, msg jsonb, delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[] | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay timestamp with time zone | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay integer | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[] | SETOF bigint - pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay timestamp with time zone | SETOF bigint pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay integer | SETOF bigint pgmq | pgmq | set_vt | queue_name text, msg_id bigint, vt integer | SETOF pgmq.message_record pgmq | pgmq | validate_queue_name | queue_name text | void @@ -4886,7 +4915,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(4728 rows) +(4757 rows) /* @@ -4918,8 +4947,8 @@ order by n.nspname, pc.relname, pa.attname; - extension_name | schema_name | entity_name | attname -------------------------------+-------------+-------------------------+------------------------ + extension_name | schema_name | entity_name | attname +------------------------------+-------------+-------------------------+-------------------------------- address_standardizer_data_us | public | us_gaz | id address_standardizer_data_us | public | us_gaz | is_custom address_standardizer_data_us | public | us_gaz | seq @@ -4969,6 +4998,65 @@ order by pg_net | net | http_request_queue | method pg_net | net | http_request_queue | timeout_milliseconds pg_net | net | http_request_queue | url + pg_partman | partman | part_config | automatic_maintenance + pg_partman | partman | part_config | constraint_cols + pg_partman | partman | part_config | constraint_valid + pg_partman | partman | part_config | control + pg_partman | partman | part_config | date_trunc_interval + pg_partman | partman | part_config | datetime_string + pg_partman | partman | part_config | epoch + pg_partman | partman | part_config | ignore_default_data + pg_partman | partman | part_config | infinite_time_partitions + pg_partman | partman | part_config | inherit_privileges + pg_partman | partman | part_config | jobmon + pg_partman | partman | part_config | maintenance_last_run + pg_partman | partman | part_config | maintenance_order + pg_partman | partman | part_config | optimize_constraint + pg_partman | partman | part_config | parent_table + pg_partman | partman | part_config | partition_interval + pg_partman | partman | part_config | partition_type + pg_partman | partman | part_config | premake + pg_partman | partman | part_config | retention + pg_partman | partman | part_config | retention_keep_index + pg_partman | partman | part_config | retention_keep_publication + pg_partman | partman | part_config | retention_keep_table + pg_partman | partman | part_config | retention_schema + pg_partman | partman | part_config | sub_partition_set_full + pg_partman | partman | part_config | template_table + pg_partman | partman | part_config | time_decoder + pg_partman | partman | part_config | time_encoder + pg_partman | partman | part_config | undo_in_progress + pg_partman | partman | part_config_sub | sub_automatic_maintenance + pg_partman | partman | part_config_sub | sub_constraint_cols + pg_partman | partman | part_config_sub | sub_constraint_valid + pg_partman | partman | part_config_sub | sub_control + pg_partman | partman | part_config_sub | sub_control_not_null + pg_partman | partman | part_config_sub | sub_date_trunc_interval + pg_partman | partman | part_config_sub | sub_default_table + pg_partman | partman | part_config_sub | sub_epoch + pg_partman | partman | part_config_sub | sub_ignore_default_data + pg_partman | partman | part_config_sub | sub_infinite_time_partitions + pg_partman | partman | part_config_sub | sub_inherit_privileges + pg_partman | partman | part_config_sub | sub_jobmon + pg_partman | partman | part_config_sub | sub_maintenance_order + pg_partman | partman | part_config_sub | sub_optimize_constraint + pg_partman | partman | part_config_sub | sub_parent + pg_partman | partman | part_config_sub | sub_partition_interval + pg_partman | partman | part_config_sub | sub_partition_type + pg_partman | partman | part_config_sub | sub_premake + pg_partman | partman | part_config_sub | sub_retention + pg_partman | partman | part_config_sub | sub_retention_keep_index + pg_partman | partman | part_config_sub | sub_retention_keep_publication + pg_partman | partman | part_config_sub | sub_retention_keep_table + pg_partman | partman | part_config_sub | sub_retention_schema + pg_partman | partman | part_config_sub | sub_template_table + pg_partman | partman | part_config_sub | sub_time_decoder + pg_partman | partman | part_config_sub | sub_time_encoder + pg_partman | partman | table_privs | grantee + pg_partman | partman | table_privs | grantor + pg_partman | partman | table_privs | privilege_type + pg_partman | partman | table_privs | table_name + pg_partman | partman | table_privs | table_schema pg_repack | repack | primary_keys | indexrelid pg_repack | repack | primary_keys | indrelid pg_repack | repack | tables | alter_col_storage @@ -5123,7 +5211,6 @@ order by pg_tle | pgtle | feature_info | schema_name pgmq | pgmq | a_foo | archived_at pgmq | pgmq | a_foo | enqueued_at - pgmq | pgmq | a_foo | headers pgmq | pgmq | a_foo | message pgmq | pgmq | a_foo | msg_id pgmq | pgmq | a_foo | read_ct @@ -5133,7 +5220,6 @@ order by pgmq | pgmq | meta | is_unlogged pgmq | pgmq | meta | queue_name pgmq | pgmq | q_foo | enqueued_at - pgmq | pgmq | q_foo | headers pgmq | pgmq | q_foo | message pgmq | pgmq | q_foo | msg_id pgmq | pgmq | q_foo | read_ct @@ -5309,5 +5395,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(389 rows) +(446 rows) diff --git a/nix/tests/prime.sql b/nix/tests/prime.sql index fb724847f..5ae47444e 100644 --- a/nix/tests/prime.sql +++ b/nix/tests/prime.sql @@ -46,6 +46,8 @@ create extension if not exists pg_hashids; create extension if not exists pg_prewarm; create extension if not exists pgmq; create extension if not exists pg_jsonschema; +create schema if not exists partman; +create extension if not exists pg_partman with schema partman; create extension if not exists pg_repack; create extension if not exists pg_stat_monitor; create extension if not exists pg_stat_statements; From 2f53cdd165ca16064c23648507403cc30bb647e8 Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Thu, 16 Oct 2025 08:46:51 +0300 Subject: [PATCH 06/11] add hypertable to partman test --- .../z_15_unhype_timescale_to_partman.out | 77 +++++++++++++++++++ .../sql/z_15_unhype_timescale_to_partman.sql | 58 ++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 nix/tests/expected/z_15_unhype_timescale_to_partman.out create mode 100644 nix/tests/sql/z_15_unhype_timescale_to_partman.sql diff --git a/nix/tests/expected/z_15_unhype_timescale_to_partman.out b/nix/tests/expected/z_15_unhype_timescale_to_partman.out new file mode 100644 index 000000000..fa4eb37dc --- /dev/null +++ b/nix/tests/expected/z_15_unhype_timescale_to_partman.out @@ -0,0 +1,77 @@ +/* + +The purpose of this test is to validate the method of moving from Timescale Hypertables to Postgres native partitioned tables +managed by pg_partman + +*/ +CREATE SCHEMA ts; +-- Create a table for time-series data +CREATE TABLE ts.readings ( + time TIMESTAMPTZ NOT NULL, + sensor_id INT NOT NULL, + value DOUBLE PRECISION NOT NULL +); +-- Convert the table into a hypertable +SELECT create_hypertable('ts.readings', by_range('time', INTERVAL '1 day')); + create_hypertable +------------------- + (2,t) +(1 row) + +-- Convert default 7 day chunk interval +SELECT set_chunk_time_interval('ts.readings', INTERVAL '24 hours'); + set_chunk_time_interval +------------------------- + +(1 row) + +-- Insert sample data +INSERT INTO ts.readings (time, sensor_id, value) +SELECT + time_series AS time, + FLOOR(RANDOM() * 10 + 1)::INT AS sensor_id, -- Random sensor_id between 1 and 10 + RANDOM() * 100 AS value -- Random value between 0 and 100 +FROM + generate_series( + '2023-01-19 00:00:00+00'::TIMESTAMPTZ, + '2025-03-26 03:00:00+00'::TIMESTAMPTZ, + INTERVAL '1 second' + ) AS time_series +LIMIT 600000; +-- List hypertables +SELECT * FROM timescaledb_information.hypertables; + hypertable_schema | hypertable_name | owner | num_dimensions | num_chunks | compression_enabled | tablespaces +-------------------+-----------------+----------------+----------------+------------+---------------------+------------- + ts | readings | supabase_admin | 1 | 7 | f | +(1 row) + +-- Rename hypertable +ALTER TABLE ts.readings RENAME TO ht_readings; +-- Create copy of hypertable with original name +CREATE TABLE ts.readings (LIKE ts.ht_readings) PARTITION BY RANGE(time); +-- Configure pg_partman for daily partitions on sensor_data +SELECT partman.create_parent( + p_parent_table := 'ts.readings', + p_control := 'time', + p_type := 'range', + p_interval := '1 day', + p_premake := 7, -- Create partitions for the next 7 days + p_start_partition := '2023-01-19 00:00:00+00' -- Start date for partitioning +); + create_parent +--------------- + t +(1 row) + +INSERT INTO ts.readings SELECT * FROM ts.ht_readings; +DROP SCHEMA ts CASCADE; +NOTICE: drop cascades to 9 other objects +DETAIL: drop cascades to table ts.ht_readings +drop cascades to table _timescaledb_internal._hyper_2_3_chunk +drop cascades to table _timescaledb_internal._hyper_2_4_chunk +drop cascades to table _timescaledb_internal._hyper_2_5_chunk +drop cascades to table _timescaledb_internal._hyper_2_6_chunk +drop cascades to table _timescaledb_internal._hyper_2_7_chunk +drop cascades to table _timescaledb_internal._hyper_2_8_chunk +drop cascades to table _timescaledb_internal._hyper_2_9_chunk +drop cascades to table ts.readings diff --git a/nix/tests/sql/z_15_unhype_timescale_to_partman.sql b/nix/tests/sql/z_15_unhype_timescale_to_partman.sql new file mode 100644 index 000000000..795e3ae54 --- /dev/null +++ b/nix/tests/sql/z_15_unhype_timescale_to_partman.sql @@ -0,0 +1,58 @@ +/* + +The purpose of this test is to validate the method of moving from Timescale Hypertables to Postgres native partitioned tables +managed by pg_partman + +*/ + +CREATE SCHEMA ts; + +-- Create a table for time-series data +CREATE TABLE ts.readings ( + time TIMESTAMPTZ NOT NULL, + sensor_id INT NOT NULL, + value DOUBLE PRECISION NOT NULL +); + +-- Convert the table into a hypertable +SELECT create_hypertable('ts.readings', by_range('time', INTERVAL '1 day')); + +-- Convert default 7 day chunk interval +SELECT set_chunk_time_interval('ts.readings', INTERVAL '24 hours'); + +-- Insert sample data +INSERT INTO ts.readings (time, sensor_id, value) +SELECT + time_series AS time, + FLOOR(RANDOM() * 10 + 1)::INT AS sensor_id, -- Random sensor_id between 1 and 10 + RANDOM() * 100 AS value -- Random value between 0 and 100 +FROM + generate_series( + '2023-01-19 00:00:00+00'::TIMESTAMPTZ, + '2025-03-26 03:00:00+00'::TIMESTAMPTZ, + INTERVAL '1 second' + ) AS time_series +LIMIT 600000; + +-- List hypertables +SELECT * FROM timescaledb_information.hypertables; + +-- Rename hypertable +ALTER TABLE ts.readings RENAME TO ht_readings; + +-- Create copy of hypertable with original name +CREATE TABLE ts.readings (LIKE ts.ht_readings) PARTITION BY RANGE(time); + +-- Configure pg_partman for daily partitions on sensor_data +SELECT partman.create_parent( + p_parent_table := 'ts.readings', + p_control := 'time', + p_type := 'range', + p_interval := '1 day', + p_premake := 7, -- Create partitions for the next 7 days + p_start_partition := '2023-01-19 00:00:00+00' -- Start date for partitioning +); + +INSERT INTO ts.readings SELECT * FROM ts.ht_readings; + +DROP SCHEMA ts CASCADE; \ No newline at end of file From bf46d895e9d8b5a5f65f2d368af1b11034ae88cc Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 22 Oct 2025 17:29:12 -0400 Subject: [PATCH 07/11] feat: multiversion pg_partman --- nix/tests/expected/z_15_ext_interface.out | 22 +++- nix/tests/expected/z_17_ext_interface.out | 22 +++- .../expected/z_orioledb-17_ext_interface.out | 118 ++++++++++++++++-- 3 files changed, 145 insertions(+), 17 deletions(-) diff --git a/nix/tests/expected/z_15_ext_interface.out b/nix/tests/expected/z_15_ext_interface.out index c98547058..aae3958b7 100644 --- a/nix/tests/expected/z_15_ext_interface.out +++ b/nix/tests/expected/z_15_ext_interface.out @@ -1362,6 +1362,7 @@ order by pgcrypto | extensions | pgp_sym_encrypt_bytea | bytea, text, text | bytea pgmq | pgmq | _belongs_to_pgmq | table_name text | boolean pgmq | pgmq | _ensure_pg_partman_installed | | void + pgmq | pgmq | _extension_exists | extension_name text | boolean pgmq | pgmq | _get_partition_col | partition_interval text | text pgmq | pgmq | _get_pg_partman_major_version | | integer pgmq | pgmq | _get_pg_partman_schema | | text @@ -1375,6 +1376,7 @@ order by pgmq | pgmq | delete | queue_name text, msg_id bigint | boolean pgmq | pgmq | delete | queue_name text, msg_ids bigint[] | SETOF bigint pgmq | pgmq | detach_archive | queue_name text | void + pgmq | pgmq | drop_queue | queue_name text, partitioned boolean | boolean pgmq | pgmq | drop_queue | queue_name text | boolean pgmq | pgmq | format_table_name | queue_name text, prefix text | text pgmq | pgmq | list_queues | | SETOF pgmq.queue_record @@ -1382,9 +1384,19 @@ order by pgmq | pgmq | metrics_all | | SETOF pgmq.metrics_result pgmq | pgmq | pop | queue_name text | SETOF pgmq.message_record pgmq | pgmq | purge_queue | queue_name text | bigint - pgmq | pgmq | read | queue_name text, vt integer, qty integer | SETOF pgmq.message_record - pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer | SETOF pgmq.message_record + pgmq | pgmq | read | queue_name text, vt integer, qty integer, conditional jsonb | SETOF pgmq.message_record + pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer, conditional jsonb | SETOF pgmq.message_record + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb | SETOF bigint pgmq | pgmq | send | queue_name text, msg jsonb, delay integer | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay integer | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[] | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay integer | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[] | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay timestamp with time zone | SETOF bigint pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay integer | SETOF bigint pgmq | pgmq | set_vt | queue_name text, msg_id bigint, vt integer | SETOF pgmq.message_record pgmq | pgmq | validate_queue_name | queue_name text | void @@ -5271,7 +5283,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(5100 rows) +(5112 rows) /* @@ -5555,6 +5567,7 @@ order by pg_tle | pgtle | feature_info | schema_name pgmq | pgmq | a_foo | archived_at pgmq | pgmq | a_foo | enqueued_at + pgmq | pgmq | a_foo | headers pgmq | pgmq | a_foo | message pgmq | pgmq | a_foo | msg_id pgmq | pgmq | a_foo | read_ct @@ -5564,6 +5577,7 @@ order by pgmq | pgmq | meta | is_unlogged pgmq | pgmq | meta | queue_name pgmq | pgmq | q_foo | enqueued_at + pgmq | pgmq | q_foo | headers pgmq | pgmq | q_foo | message pgmq | pgmq | q_foo | msg_id pgmq | pgmq | q_foo | read_ct @@ -6470,5 +6484,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(1165 rows) +(1167 rows) diff --git a/nix/tests/expected/z_17_ext_interface.out b/nix/tests/expected/z_17_ext_interface.out index 96baed46f..89fc4c1bc 100644 --- a/nix/tests/expected/z_17_ext_interface.out +++ b/nix/tests/expected/z_17_ext_interface.out @@ -1347,6 +1347,7 @@ order by pgcrypto | extensions | pgp_sym_encrypt_bytea | bytea, text, text | bytea pgmq | pgmq | _belongs_to_pgmq | table_name text | boolean pgmq | pgmq | _ensure_pg_partman_installed | | void + pgmq | pgmq | _extension_exists | extension_name text | boolean pgmq | pgmq | _get_partition_col | partition_interval text | text pgmq | pgmq | _get_pg_partman_major_version | | integer pgmq | pgmq | _get_pg_partman_schema | | text @@ -1360,6 +1361,7 @@ order by pgmq | pgmq | delete | queue_name text, msg_id bigint | boolean pgmq | pgmq | delete | queue_name text, msg_ids bigint[] | SETOF bigint pgmq | pgmq | detach_archive | queue_name text | void + pgmq | pgmq | drop_queue | queue_name text, partitioned boolean | boolean pgmq | pgmq | drop_queue | queue_name text | boolean pgmq | pgmq | format_table_name | queue_name text, prefix text | text pgmq | pgmq | list_queues | | SETOF pgmq.queue_record @@ -1367,9 +1369,19 @@ order by pgmq | pgmq | metrics_all | | SETOF pgmq.metrics_result pgmq | pgmq | pop | queue_name text | SETOF pgmq.message_record pgmq | pgmq | purge_queue | queue_name text | bigint - pgmq | pgmq | read | queue_name text, vt integer, qty integer | SETOF pgmq.message_record - pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer | SETOF pgmq.message_record + pgmq | pgmq | read | queue_name text, vt integer, qty integer, conditional jsonb | SETOF pgmq.message_record + pgmq | pgmq | read_with_poll | queue_name text, vt integer, qty integer, max_poll_seconds integer, poll_interval_ms integer, conditional jsonb | SETOF pgmq.message_record + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb | SETOF bigint pgmq | pgmq | send | queue_name text, msg jsonb, delay integer | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, headers jsonb, delay integer | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb | SETOF bigint + pgmq | pgmq | send | queue_name text, msg jsonb, delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[] | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay timestamp with time zone | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], headers jsonb[], delay integer | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[] | SETOF bigint + pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay timestamp with time zone | SETOF bigint pgmq | pgmq | send_batch | queue_name text, msgs jsonb[], delay integer | SETOF bigint pgmq | pgmq | set_vt | queue_name text, msg_id bigint, vt integer | SETOF pgmq.message_record pgmq | pgmq | validate_queue_name | queue_name text | void @@ -4915,7 +4927,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(4757 rows) +(4769 rows) /* @@ -5211,6 +5223,7 @@ order by pg_tle | pgtle | feature_info | schema_name pgmq | pgmq | a_foo | archived_at pgmq | pgmq | a_foo | enqueued_at + pgmq | pgmq | a_foo | headers pgmq | pgmq | a_foo | message pgmq | pgmq | a_foo | msg_id pgmq | pgmq | a_foo | read_ct @@ -5220,6 +5233,7 @@ order by pgmq | pgmq | meta | is_unlogged pgmq | pgmq | meta | queue_name pgmq | pgmq | q_foo | enqueued_at + pgmq | pgmq | q_foo | headers pgmq | pgmq | q_foo | message pgmq | pgmq | q_foo | msg_id pgmq | pgmq | q_foo | read_ct @@ -5395,5 +5409,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(446 rows) +(448 rows) diff --git a/nix/tests/expected/z_orioledb-17_ext_interface.out b/nix/tests/expected/z_orioledb-17_ext_interface.out index 845bb25ac..89fc4c1bc 100644 --- a/nix/tests/expected/z_orioledb-17_ext_interface.out +++ b/nix/tests/expected/z_orioledb-17_ext_interface.out @@ -23,11 +23,10 @@ order by name ------------------------ pg_cron - pg_partman pgjwt postgis_tiger_geocoder tsm_system_time -(5 rows) +(4 rows) /* @@ -77,6 +76,7 @@ order by pg_hashids | t pg_jsonschema | f pg_net | f + pg_partman | f pg_prewarm | t pg_repack | f pg_stat_monitor | t @@ -116,7 +116,7 @@ order by vector | t wrappers | t xml2 | f -(72 rows) +(73 rows) /* @@ -156,8 +156,8 @@ order by n.nspname, p.proname, md5(pg_catalog.pg_get_function_identity_arguments(p.oid)); - extension_name | schema_name | function_name | argument_types | return_type -----------------------+----------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + extension_name | schema_name | function_name | argument_types | return_type +----------------------+----------------+--------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ address_standardizer | public | parse_address | text, OUT num text, OUT street text, OUT street2 text, OUT address1 text, OUT city text, OUT state text, OUT zip text, OUT zipplus text, OUT country text | record address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, address text | stdaddr address_standardizer | public | standardize_address | lextab text, gaztab text, rultab text, micro text, macro text | stdaddr @@ -1153,6 +1153,47 @@ order by pg_net | net | wait_until_running | | void pg_net | net | wake | | void pg_net | net | worker_restart | | boolean + pg_partman | partman | apply_cluster | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text | void + pg_partman | partman | apply_constraints | p_parent_table text, p_child_table text, p_analyze boolean, p_job_id bigint | void + pg_partman | partman | apply_privileges | p_parent_schema text, p_parent_tablename text, p_child_schema text, p_child_tablename text, p_job_id bigint | void + pg_partman | partman | autovacuum_off | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | autovacuum_reset | p_parent_schema text, p_parent_tablename text, p_source_schema text, p_source_tablename text | boolean + pg_partman | partman | calculate_time_partition_info | p_time_interval interval, p_start_time timestamp with time zone, p_date_trunc_interval text, OUT base_timestamp timestamp with time zone, OUT datetime_string text | record + pg_partman | partman | check_automatic_maintenance_value | p_automatic_maintenance text | boolean + pg_partman | partman | check_control_type | p_parent_schema text, p_parent_tablename text, p_control text | TABLE(general_type text, exact_type text) + pg_partman | partman | check_default | p_exact_count boolean | SETOF partman.check_default_table + pg_partman | partman | check_epoch_type | p_type text | boolean + pg_partman | partman | check_name_length | p_object_name text, p_suffix text, p_table_partition boolean | text + pg_partman | partman | check_partition_type | p_type text | boolean + pg_partman | partman | check_subpart_sameconfig | p_parent_table text | TABLE(sub_control text, sub_partition_interval text, sub_partition_type text, sub_premake integer, sub_automatic_maintenance text, sub_template_table text, sub_retention text, sub_retention_schema text, sub_retention_keep_index boolean, sub_retention_keep_table boolean, sub_epoch text, sub_constraint_cols text[], sub_optimize_constraint integer, sub_infinite_time_partitions boolean, sub_jobmon boolean, sub_inherit_privileges boolean, sub_constraint_valid boolean, sub_date_trunc_interval text, sub_ignore_default_data boolean, sub_default_table boolean, sub_maintenance_order integer, sub_retention_keep_publication boolean, sub_control_not_null boolean) + pg_partman | partman | check_subpartition_limits | p_parent_table text, p_type text, OUT sub_min text, OUT sub_max text | record + pg_partman | partman | create_parent | p_parent_table text, p_control text, p_interval text, p_type text, p_epoch text, p_premake integer, p_start_partition text, p_default_table boolean, p_automatic_maintenance text, p_constraint_cols text[], p_template_table text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | create_partition_id | p_parent_table text, p_partition_ids bigint[], p_start_partition text | boolean + pg_partman | partman | create_partition_time | p_parent_table text, p_partition_times timestamp with time zone[], p_start_partition text | boolean + pg_partman | partman | create_sub_parent | p_top_parent text, p_control text, p_interval text, p_type text, p_default_table boolean, p_declarative_check text, p_constraint_cols text[], p_premake integer, p_start_partition text, p_epoch text, p_jobmon boolean, p_date_trunc_interval text, p_control_not_null boolean, p_time_encoder text, p_time_decoder text | boolean + pg_partman | partman | drop_constraints | p_parent_table text, p_child_table text, p_debug boolean | void + pg_partman | partman | drop_partition_id | p_parent_table text, p_retention bigint, p_keep_table boolean, p_keep_index boolean, p_retention_schema text | integer + pg_partman | partman | drop_partition_time | p_parent_table text, p_retention interval, p_keep_table boolean, p_keep_index boolean, p_retention_schema text, p_reference_timestamp timestamp with time zone | integer + pg_partman | partman | dump_partitioned_table_definition | p_parent_table text, p_ignore_template_table boolean | text + pg_partman | partman | inherit_replica_identity | p_parent_schemaname text, p_parent_tablename text, p_child_tablename text | void + pg_partman | partman | inherit_template_properties | p_parent_table text, p_child_schema text, p_child_tablename text | boolean + pg_partman | partman | partition_data_id | p_parent_table text, p_batch_count integer, p_batch_interval bigint, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_data_proc | IN p_parent_table text, IN p_loop_count integer, IN p_interval text, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_order text, IN p_source_table text, IN p_ignored_columns text[], IN p_quiet boolean | + pg_partman | partman | partition_data_time | p_parent_table text, p_batch_count integer, p_batch_interval interval, p_lock_wait numeric, p_order text, p_analyze boolean, p_source_table text, p_ignored_columns text[] | bigint + pg_partman | partman | partition_gap_fill | p_parent_table text | integer + pg_partman | partman | reapply_constraints_proc | IN p_parent_table text, IN p_drop_constraints boolean, IN p_apply_constraints boolean, IN p_wait integer, IN p_dryrun boolean | + pg_partman | partman | reapply_privileges | p_parent_table text | void + pg_partman | partman | run_analyze | IN p_skip_locked boolean, IN p_quiet boolean, IN p_parent_table text | + pg_partman | partman | run_maintenance | p_parent_table text, p_analyze boolean, p_jobmon boolean | void + pg_partman | partman | run_maintenance_proc | IN p_wait integer, IN p_analyze boolean, IN p_jobmon boolean | + pg_partman | partman | show_partition_info | p_child_table text, p_partition_interval text, p_parent_table text, OUT child_start_time timestamp with time zone, OUT child_end_time timestamp with time zone, OUT child_start_id bigint, OUT child_end_id bigint, OUT suffix text | record + pg_partman | partman | show_partition_name | p_parent_table text, p_value text, OUT partition_schema text, OUT partition_table text, OUT suffix_timestamp timestamp with time zone, OUT suffix_id bigint, OUT table_exists boolean | record + pg_partman | partman | show_partitions | p_parent_table text, p_order text, p_include_default boolean | TABLE(partition_schemaname text, partition_tablename text) + pg_partman | partman | stop_sub_partition | p_parent_table text, p_jobmon boolean | boolean + pg_partman | partman | undo_partition | p_parent_table text, p_target_table text, p_loop_count integer, p_batch_interval text, p_keep_table boolean, p_lock_wait numeric, p_ignored_columns text[], p_drop_cascade boolean, OUT partitions_undone integer, OUT rows_undone bigint | record + pg_partman | partman | undo_partition_proc | IN p_parent_table text, IN p_target_table text, IN p_loop_count integer, IN p_interval text, IN p_keep_table boolean, IN p_lock_wait integer, IN p_lock_wait_tries integer, IN p_wait integer, IN p_ignored_columns text[], IN p_drop_cascade boolean, IN p_quiet boolean | + pg_partman | partman | uuid7_time_decoder | uuidv7 text | timestamp with time zone + pg_partman | partman | uuid7_time_encoder | ts timestamp with time zone | uuid pg_prewarm | public | autoprewarm_dump_now | | bigint pg_prewarm | public | autoprewarm_start_worker | | void pg_prewarm | public | pg_prewarm | regclass, mode text, fork text, first_block bigint, last_block bigint | bigint @@ -4886,7 +4927,7 @@ order by xml2 | public | xpath_table | text, text, text, text, text | SETOF record xml2 | public | xslt_process | text, text | text xml2 | public | xslt_process | text, text, text | text -(4728 rows) +(4769 rows) /* @@ -4918,8 +4959,8 @@ order by n.nspname, pc.relname, pa.attname; - extension_name | schema_name | entity_name | attname -------------------------------+-------------+-------------------------+------------------------ + extension_name | schema_name | entity_name | attname +------------------------------+-------------+-------------------------+-------------------------------- address_standardizer_data_us | public | us_gaz | id address_standardizer_data_us | public | us_gaz | is_custom address_standardizer_data_us | public | us_gaz | seq @@ -4969,6 +5010,65 @@ order by pg_net | net | http_request_queue | method pg_net | net | http_request_queue | timeout_milliseconds pg_net | net | http_request_queue | url + pg_partman | partman | part_config | automatic_maintenance + pg_partman | partman | part_config | constraint_cols + pg_partman | partman | part_config | constraint_valid + pg_partman | partman | part_config | control + pg_partman | partman | part_config | date_trunc_interval + pg_partman | partman | part_config | datetime_string + pg_partman | partman | part_config | epoch + pg_partman | partman | part_config | ignore_default_data + pg_partman | partman | part_config | infinite_time_partitions + pg_partman | partman | part_config | inherit_privileges + pg_partman | partman | part_config | jobmon + pg_partman | partman | part_config | maintenance_last_run + pg_partman | partman | part_config | maintenance_order + pg_partman | partman | part_config | optimize_constraint + pg_partman | partman | part_config | parent_table + pg_partman | partman | part_config | partition_interval + pg_partman | partman | part_config | partition_type + pg_partman | partman | part_config | premake + pg_partman | partman | part_config | retention + pg_partman | partman | part_config | retention_keep_index + pg_partman | partman | part_config | retention_keep_publication + pg_partman | partman | part_config | retention_keep_table + pg_partman | partman | part_config | retention_schema + pg_partman | partman | part_config | sub_partition_set_full + pg_partman | partman | part_config | template_table + pg_partman | partman | part_config | time_decoder + pg_partman | partman | part_config | time_encoder + pg_partman | partman | part_config | undo_in_progress + pg_partman | partman | part_config_sub | sub_automatic_maintenance + pg_partman | partman | part_config_sub | sub_constraint_cols + pg_partman | partman | part_config_sub | sub_constraint_valid + pg_partman | partman | part_config_sub | sub_control + pg_partman | partman | part_config_sub | sub_control_not_null + pg_partman | partman | part_config_sub | sub_date_trunc_interval + pg_partman | partman | part_config_sub | sub_default_table + pg_partman | partman | part_config_sub | sub_epoch + pg_partman | partman | part_config_sub | sub_ignore_default_data + pg_partman | partman | part_config_sub | sub_infinite_time_partitions + pg_partman | partman | part_config_sub | sub_inherit_privileges + pg_partman | partman | part_config_sub | sub_jobmon + pg_partman | partman | part_config_sub | sub_maintenance_order + pg_partman | partman | part_config_sub | sub_optimize_constraint + pg_partman | partman | part_config_sub | sub_parent + pg_partman | partman | part_config_sub | sub_partition_interval + pg_partman | partman | part_config_sub | sub_partition_type + pg_partman | partman | part_config_sub | sub_premake + pg_partman | partman | part_config_sub | sub_retention + pg_partman | partman | part_config_sub | sub_retention_keep_index + pg_partman | partman | part_config_sub | sub_retention_keep_publication + pg_partman | partman | part_config_sub | sub_retention_keep_table + pg_partman | partman | part_config_sub | sub_retention_schema + pg_partman | partman | part_config_sub | sub_template_table + pg_partman | partman | part_config_sub | sub_time_decoder + pg_partman | partman | part_config_sub | sub_time_encoder + pg_partman | partman | table_privs | grantee + pg_partman | partman | table_privs | grantor + pg_partman | partman | table_privs | privilege_type + pg_partman | partman | table_privs | table_name + pg_partman | partman | table_privs | table_schema pg_repack | repack | primary_keys | indexrelid pg_repack | repack | primary_keys | indrelid pg_repack | repack | tables | alter_col_storage @@ -5309,5 +5409,5 @@ order by wrappers | public | wrappers_fdw_stats | rows_in wrappers | public | wrappers_fdw_stats | rows_out wrappers | public | wrappers_fdw_stats | updated_at -(389 rows) +(448 rows) From 849e1f6e638905e7339f9c2844e7a66923b5e040 Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Thu, 23 Oct 2025 14:33:17 +0300 Subject: [PATCH 08/11] update v15 schema --- migrations/schema-15.sql | 3 --- 1 file changed, 3 deletions(-) diff --git a/migrations/schema-15.sql b/migrations/schema-15.sql index 65c53004b..1f1d98496 100644 --- a/migrations/schema-15.sql +++ b/migrations/schema-15.sql @@ -87,9 +87,6 @@ CREATE EXTENSION IF NOT EXISTS pg_graphql WITH SCHEMA graphql; COMMENT ON EXTENSION pg_graphql IS 'pg_graphql: GraphQL support'; -CREATE SCHEMA partman; -CREATE EXTENSION IF NOT EXISTS pg_partman WITH SCHEMA partman; - -- -- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: - From 430c1e87a987640a3361d462926cab2d9322263c Mon Sep 17 00:00:00 2001 From: Chris Gwilliams <517923+encima@users.noreply.github.com> Date: Fri, 24 Oct 2025 11:00:59 +0300 Subject: [PATCH 09/11] add suffix to version for staging test --- ansible/vars.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/vars.yml b/ansible/vars.yml index 75854490d..161e588a7 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -10,9 +10,9 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.5.1.046-orioledb" - postgres17: "17.6.1.025" - postgres15: "15.14.1.025" + postgresorioledb-17: "17.5.1.046-orioledb-test-partman" + postgres17: "17.6.1.025-test-partman" + postgres15: "15.14.1.025-test-partman" # Non Postgres Extensions pgbouncer_release: 1.19.0 From 0848aed710b7fc6a175d4844dcfbaa6faf35343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= Date: Tue, 28 Oct 2025 13:04:03 +0100 Subject: [PATCH 10/11] Add nixos test for pg_partman extension Run upgrade and pg_regress tests for pg_partman extension in NixOS tests. --- nix/ext/pg_partman.nix | 3 ++- nix/ext/tests/default.nix | 5 ++++- nix/ext/tests/lib.py | 11 ++++++++++- nix/tests/expected/pg_partman.out | 4 ++++ nix/tests/sql/pg_partman.sql | 2 ++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/nix/ext/pg_partman.nix b/nix/ext/pg_partman.nix index d178d16e6..437db5131 100644 --- a/nix/ext/pg_partman.nix +++ b/nix/ext/pg_partman.nix @@ -97,8 +97,9 @@ pkgs.buildEnv { inherit versions numberOfVersions switch-ext-version; pname = "${pname}-all"; hasBackgroundWorker = true; + defaultSchema = "partman"; defaultSettings = { - shared_preload_libraries = [ "pg_partman_bgw" ]; + shared_preload_libraries = [ "pg_partman" ]; }; version = "multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions); diff --git a/nix/ext/tests/default.nix b/nix/ext/tests/default.nix index 9a379d587..ef98b416c 100644 --- a/nix/ext/tests/default.nix +++ b/nix/ext/tests/default.nix @@ -138,6 +138,7 @@ let } sql_test_directory = Path("${../../tests}") pg_regress_test_name = "${(installedExtension "15").pgRegressTestName or pname}" + ext_schema = "${(installedExtension "15").defaultSchema or "public"}" ${builtins.readFile ./lib.py} @@ -146,7 +147,8 @@ let server.wait_for_unit("multi-user.target") server.wait_for_unit("postgresql.service") - test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade) + test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade, ext_schema) + test.create_schema() with subtest("Check upgrade path with postgresql 15"): test.check_upgrade_path("15") @@ -206,6 +208,7 @@ builtins.listToAttrs ( "pg_graphql" "pg_jsonschema" "pg_net" + "pg_partman" "vector" "wrappers" ] diff --git a/nix/ext/tests/lib.py b/nix/ext/tests/lib.py index 3383f2498..232919c4c 100644 --- a/nix/ext/tests/lib.py +++ b/nix/ext/tests/lib.py @@ -20,6 +20,7 @@ def __init__( versions: Versions, sql_test_dir: Path, support_upgrade: bool = True, + schema: str = "public", ): """Initialize the PostgreSQL extension test framework. @@ -35,6 +36,10 @@ def __init__( self.versions = versions self.support_upgrade = support_upgrade self.sql_test_dir = sql_test_dir + self.schema = schema + + def create_schema(self): + self.run_sql(f"CREATE SCHEMA IF NOT EXISTS {self.schema};") def run_sql(self, query: str) -> str: return self.vm.succeed( @@ -50,8 +55,12 @@ def drop_extension(self): self.run_sql(f"DROP EXTENSION IF EXISTS {self.extension_name};") def install_extension(self, version: str): + if self.schema != "public": + ext_schema = f"SCHEMA {self.schema} " + else: + ext_schema = "" self.run_sql( - f"""CREATE EXTENSION {self.extension_name} WITH VERSION '{version}' CASCADE;""" + f"""CREATE EXTENSION {self.extension_name} WITH {ext_schema}VERSION '{version}' CASCADE;""" ) # Verify version was installed correctly self.assert_version_matches(version) diff --git a/nix/tests/expected/pg_partman.out b/nix/tests/expected/pg_partman.out index b32e64bba..16d0f43de 100644 --- a/nix/tests/expected/pg_partman.out +++ b/nix/tests/expected/pg_partman.out @@ -18,3 +18,7 @@ SELECT partman.create_parent( t (1 row) +DROP SCHEMA partman_test CASCADE; +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to table partman_test.time_taptest_table +drop cascades to table partman_test.time_taptest_table_template diff --git a/nix/tests/sql/pg_partman.sql b/nix/tests/sql/pg_partman.sql index bb018460d..db686b78c 100644 --- a/nix/tests/sql/pg_partman.sql +++ b/nix/tests/sql/pg_partman.sql @@ -18,3 +18,5 @@ SELECT partman.create_parent( , p_interval := '1 day' , p_template_table := 'partman_test.time_taptest_table_template' ); + +DROP SCHEMA partman_test CASCADE; From a6cc4d571f4fbef56a115a756eceb55b99174cf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Roche?= Date: Tue, 28 Oct 2025 13:13:16 +0100 Subject: [PATCH 11/11] Update version suffix to avoid conflict --- ansible/vars.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible/vars.yml b/ansible/vars.yml index 161e588a7..0f9424813 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -10,9 +10,9 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.5.1.046-orioledb-test-partman" - postgres17: "17.6.1.025-test-partman" - postgres15: "15.14.1.025-test-partman" + postgresorioledb-17: "17.5.1.051-orioledb-test-partman" + postgres17: "17.6.1.030-test-partman" + postgres15: "15.14.1.030-test-partman" # Non Postgres Extensions pgbouncer_release: 1.19.0