From 274cbefbfa197be5e28f466e7201f5f80caf5fa8 Mon Sep 17 00:00:00 2001 From: Josh Ventura Date: Tue, 28 Jul 2026 17:45:51 -0700 Subject: [PATCH 1/2] chore(release): bump META.json version to 0.4.0 --- META.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/META.json b/META.json index 0f0ab75..3351e7f 100644 --- a/META.json +++ b/META.json @@ -30,7 +30,7 @@ "abstract": "PostgreSQL Query Telemetry Exporter to ClickHouse", "docfile": "README.md", "file": "pg_stat_ch.control", - "version": "0.3.11" + "version": "0.4.0" } }, "resources": { @@ -49,5 +49,5 @@ "metrics", "clickhouse" ], - "version": "0.3.11" + "version": "0.4.0" } From f24db85efcac576b8ab62ade74a9815eaaa5ed4f Mon Sep 17 00:00:00 2001 From: Josh Ventura Date: Wed, 29 Jul 2026 15:50:33 -0700 Subject: [PATCH 2/2] chore(release): bump default_version to 0.4, add no-op migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per team decision: bump the extension's default_version alongside the 0.4.0 tag even though there's no SQL interface change this release, so ALTER EXTENSION has a defined migration path from 0.3 to 0.4 instead of a gap. - sql/pg_stat_ch--0.4.sql: identical to --0.3.sql (no function/type changes). Added rather than renaming 0.3's script, since 0.3 is a live, currently-installed version (unlike the 0.1 retirement precedent in eb3a5dd) — explicit VERSION '0.3' installs and the existing 0.1->0.3 upgrade path both still need it to exist. - sql/pg_stat_ch--0.3--0.4.sql: no-op incremental migration, with a comment noting what this release actually changes lives entirely on the ClickHouse side (the new events_raw schema + the use_unified_arrow_exporter opt-in GUC), not in this extension's SQL interface. - pg_stat_ch.control: default_version 0.3 -> 0.4. CMakeLists.txt's install rule globs sql/pg_stat_ch--*.sql, so no build-system changes needed to pick up the new files. Co-Authored-By: Claude Opus 4.7 (1M context) --- pg_stat_ch.control | 2 +- sql/pg_stat_ch--0.3--0.4.sql | 14 ++++++++++ sql/pg_stat_ch--0.4.sql | 50 ++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 sql/pg_stat_ch--0.3--0.4.sql create mode 100644 sql/pg_stat_ch--0.4.sql diff --git a/pg_stat_ch.control b/pg_stat_ch.control index 0ea7393..e46b91c 100644 --- a/pg_stat_ch.control +++ b/pg_stat_ch.control @@ -1,4 +1,4 @@ comment = 'Query telemetry exporter to ClickHouse' -default_version = '0.3' +default_version = '0.4' module_pathname = '$libdir/pg_stat_ch' relocatable = false diff --git a/sql/pg_stat_ch--0.3--0.4.sql b/sql/pg_stat_ch--0.3--0.4.sql new file mode 100644 index 0000000..a347856 --- /dev/null +++ b/sql/pg_stat_ch--0.3--0.4.sql @@ -0,0 +1,14 @@ +\echo Use "ALTER EXTENSION pg_stat_ch UPDATE TO '0.4'" to load this file. \quit + +-- 0.4 is a no-op on the Postgres side: no functions, types, or other SQL +-- objects changed. The default_version bump exists purely so +-- `ALTER EXTENSION pg_stat_ch UPDATE` has a migration path to follow — +-- without this file, an install pinned at extversion='0.3' would have no +-- way to reach '0.4' once that becomes the control file's default_version. +-- +-- What actually changed in this release lives entirely on the ClickHouse +-- side: the exporter can now write to a new unified `events_raw` schema +-- (see schema/migrations/) via the `pg_stat_ch.use_unified_arrow_exporter` +-- GUC, replacing the legacy `query_logs_arrow` wire shape. That's an +-- opt-in producer/schema change, not a change to this extension's SQL +-- interface, so there's nothing to migrate here. diff --git a/sql/pg_stat_ch--0.4.sql b/sql/pg_stat_ch--0.4.sql new file mode 100644 index 0000000..a0d2f20 --- /dev/null +++ b/sql/pg_stat_ch--0.4.sql @@ -0,0 +1,50 @@ +-- pg_stat_ch extension SQL definitions + +-- complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION pg_stat_ch" to load this file. \quit + +-- Version function +CREATE FUNCTION pg_stat_ch_version() +RETURNS text +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT; + +COMMENT ON FUNCTION pg_stat_ch_version() +IS 'Returns the pg_stat_ch extension version'; + +-- Stats function (11 columns) +CREATE FUNCTION pg_stat_ch_stats( + OUT enqueued_events bigint, + OUT dropped_events bigint, + OUT exported_events bigint, + OUT send_failures bigint, + OUT last_success_ts timestamptz, + OUT last_error_text text, + OUT last_error_ts timestamptz, + OUT queue_size integer, + OUT queue_capacity integer, + OUT queue_usage_pct double precision, + OUT dsa_oom_count bigint +) +RETURNS record +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT; + +COMMENT ON FUNCTION pg_stat_ch_stats() +IS 'Returns pg_stat_ch queue and exporter statistics'; + +-- Reset function +CREATE FUNCTION pg_stat_ch_reset() RETURNS void +AS 'MODULE_PATHNAME', 'pg_stat_ch_reset' +LANGUAGE C STRICT; + +COMMENT ON FUNCTION pg_stat_ch_reset() +IS 'Resets all pg_stat_ch queue counters to zero'; + +-- Flush function (trigger immediate export) +CREATE FUNCTION pg_stat_ch_flush() RETURNS void +AS 'MODULE_PATHNAME', 'pg_stat_ch_flush' +LANGUAGE C STRICT; + +COMMENT ON FUNCTION pg_stat_ch_flush() +IS 'Trigger immediate flush of queued events to ClickHouse';