You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,12 @@
1
+
5.3.1
2
+
=====
3
+
4
+
BUGFIXES
5
+
--------
6
+
- In PostgreSQL 18, handle the case where the shared library used by the background worker may be a greater version than the installed version of pg_partman (Ex. new package installed, but the extension wasn't updated). This will cause an exception to avoid any unpredictable behavior. Note this can still happen with versions lower than 18, but the ability to give the shared library a trackable version was not added until 18.
7
+
- For all versions of PostgreSQL, throw a warning if the version of the extension that has been installed to the host system (default version) is different than the version that is installed in the database. Note this can cause the same issue as the above mismatched shared library, but it also accounts for other scenarios that are not as serious to warrant an error exception. (Github PR #799)
IF current_setting('server_version_num')::int>=180000 THEN
102
+
SELECT extversion INTO v_installed_version FROMpg_catalog.pg_extensionWHERE extname ='pg_partman';
103
+
SELECT version INTO v_library_version FROMpg_catalog.pg_get_loaded_modules() WHERE module_name ='pg_partman';
104
+
105
+
IF replace(v_installed_version, '.', '')::int< replace(v_library_version, '.', '')::int THEN
106
+
RAISE EXCEPTION 'The installed version of pg_partman (%) is less than the shared library version file that has been loaded (%). Please ensure the expected version of pg_partman is installed to the system, update the extension if needed and restart the PostgreSQL instance.', v_installed_version, v_library_version;
107
+
END IF;
108
+
END IF;
109
+
110
+
-- Try and catch the same situation of a new library file existing on disk but the extension version not being updated properly in the database. Not as reliable as new feature in PG18, but better than nothing. Only do a warning since this is less definitely a problem than a known library mismatch.
101
111
SELECT default_version, installed_version INTO v_default_version, v_installed_version FROM pg_available_extensions WHERE name ='pg_partman'AND default_version != installed_version;
102
112
IF v_installed_version IS NOT NULL THEN
103
-
RAISE WARNING 'pg_partman version % is installed but version % is default. run_maintenance might not work as expected. A restart might be required after update.', v_installed_version, v_default_version;
113
+
RAISE WARNING 'pg_partman version % is installed in the database but version % is the default available. Please ensure the expected version of pg_partman is installed to the system, update the extension in all relevant databases and restart the PostgreSQL instance if a new shared library module is available. See release notes for further details.', v_installed_version, v_default_version;
104
114
END IF;
105
115
106
116
IF v_jobmon_schema IS NOT NULL THEN
@@ -242,37 +252,31 @@ LOOP
242
252
FOR v_row_max_time IN
243
253
SELECT partition_schemaname, partition_tablename FROM @[email protected]_partitions(v_row.parent_table, 'DESC', false)
244
254
LOOP
245
-
BEGIN
246
-
IF v_control_type ='time'OR (v_control_type ='id'ANDv_row.epoch<>'none') THEN
247
-
EXECUTE format('SELECT %s::text FROM %I.%I LIMIT 1'
248
-
, v_partition_expression
249
-
, v_row_max_time.partition_schemaname
250
-
, v_row_max_time.partition_tablename
251
-
) INTO v_child_timestamp;
252
-
ELSIF v_control_type IN ('text', 'uuid') THEN
253
-
EXECUTE format('SELECT %s(%s::text) FROM %I.%I LIMIT 1'
254
-
, v_time_decoder
255
-
, v_partition_expression
256
-
, v_row_max_time.partition_schemaname
257
-
, v_row_max_time.partition_tablename
258
-
) INTO v_child_timestamp;
259
-
END IF;
255
+
IF v_control_type ='time'OR (v_control_type ='id'ANDv_row.epoch<>'none') THEN
256
+
EXECUTE format('SELECT %s::text FROM %I.%I LIMIT 1'
257
+
, v_partition_expression
258
+
, v_row_max_time.partition_schemaname
259
+
, v_row_max_time.partition_tablename
260
+
) INTO v_child_timestamp;
261
+
ELSIF v_control_type IN ('text', 'uuid') THEN
262
+
EXECUTE format('SELECT %s(%s::text) FROM %I.%I LIMIT 1'
263
+
, v_time_decoder
264
+
, v_partition_expression
265
+
, v_row_max_time.partition_schemaname
266
+
, v_row_max_time.partition_tablename
267
+
) INTO v_child_timestamp;
268
+
END IF;
260
269
261
-
IF v_row.infinite_time_partitionsAND v_child_timestamp <CURRENT_TIMESTAMP THEN
262
-
-- No new data has been inserted relative to "now", but keep making child tables anyway
263
-
v_current_partition_timestamp =CURRENT_TIMESTAMP;
264
-
-- Nothing else to do in this case so just end early
265
-
EXIT;
266
-
END IF;
267
-
IF v_child_timestamp IS NOT NULL THEN
268
-
SELECT suffix_timestamp INTO v_current_partition_timestamp FROM @[email protected]_partition_name(v_row.parent_table, v_child_timestamp::text);
269
-
EXIT;
270
-
END IF;
271
-
EXCEPTION WHEN others THEN
272
-
GET STACKED DIAGNOSTICS ex_message = MESSAGE_TEXT;
0 commit comments