From 68932b003d2e49a00d794d651ae0bfc5b0888756 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 13 Aug 2025 19:55:39 +0900 Subject: [PATCH v1 04/11] Switch pg_column_toast_chunk_id() return value from oid to oid8 This is required for a follow-up patch that will add support for 8-byte TOAST values, with this function being changed so as it is able to support the largest TOAST value type available. XXX: Bump catalog version. --- src/include/catalog/pg_proc.dat | 2 +- src/backend/utils/adt/varlena.c | 2 +- src/test/isolation/expected/cluster-toast-value-reuse.out | 2 +- src/test/isolation/specs/cluster-toast-value-reuse.spec | 2 +- src/test/modules/injection_points/specs/repack_toast.spec | 2 +- src/test/regress/expected/misc_functions.out | 2 +- src/test/regress/sql/misc_functions.sql | 2 +- doc/src/sgml/func/func-admin.sgml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index fa9ae79082b8..ce49fe25d46e 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -7856,7 +7856,7 @@ proargtypes => 'any', prosrc => 'pg_column_compression' }, { oid => '6316', descr => 'chunk ID of on-disk TOASTed value', proname => 'pg_column_toast_chunk_id', provolatile => 's', - prorettype => 'oid', proargtypes => 'any', + prorettype => 'oid8', proargtypes => 'any', prosrc => 'pg_column_toast_chunk_id' }, { oid => '2322', descr => 'total disk space usage for the specified tablespace', diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index ae406f458a99..0a2377667655 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -4287,7 +4287,7 @@ pg_column_toast_chunk_id(PG_FUNCTION_ARGS) VARATT_EXTERNAL_GET_POINTER(toast_pointer, attr); - PG_RETURN_OID(toast_pointer.va_valueid); + PG_RETURN_OID8(toast_pointer.va_valueid); } /* diff --git a/src/test/isolation/expected/cluster-toast-value-reuse.out b/src/test/isolation/expected/cluster-toast-value-reuse.out index cb14ddcee34b..21859fc0dce2 100644 --- a/src/test/isolation/expected/cluster-toast-value-reuse.out +++ b/src/test/isolation/expected/cluster-toast-value-reuse.out @@ -21,7 +21,7 @@ step s2_verify_chunk_ids: SELECT o.id AS chunk_ids_preserved FROM cluster_chunk_id o JOIN cluster_toast_value c ON o.id = c.id - WHERE o.chunk_id != pg_column_toast_chunk_id(c.value); + WHERE o.chunk_id::oid8 != pg_column_toast_chunk_id(c.value); chunk_ids_preserved ------------------- diff --git a/src/test/isolation/specs/cluster-toast-value-reuse.spec b/src/test/isolation/specs/cluster-toast-value-reuse.spec index 9a2d10600b39..96cf899db296 100644 --- a/src/test/isolation/specs/cluster-toast-value-reuse.spec +++ b/src/test/isolation/specs/cluster-toast-value-reuse.spec @@ -60,7 +60,7 @@ step s2_verify_chunk_ids { SELECT o.id AS chunk_ids_preserved FROM cluster_chunk_id o JOIN cluster_toast_value c ON o.id = c.id - WHERE o.chunk_id != pg_column_toast_chunk_id(c.value); + WHERE o.chunk_id::oid8 != pg_column_toast_chunk_id(c.value); } # Run UPDATE with its transaction still open, then store the chunk IDs. diff --git a/src/test/modules/injection_points/specs/repack_toast.spec b/src/test/modules/injection_points/specs/repack_toast.spec index fa76bcf28ef9..cc8f034d0167 100644 --- a/src/test/modules/injection_points/specs/repack_toast.spec +++ b/src/test/modules/injection_points/specs/repack_toast.spec @@ -59,7 +59,7 @@ setup CREATE TABLE relfilenodes(node oid); - CREATE TABLE data_s1 (i int, j text, j_toast oid, k text, k_toast oid); + CREATE TABLE data_s1 (i int, j text, j_toast oid8, k text, k_toast oid8); CREATE TABLE data_s2 (LIKE data_s1); } diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out index c3261bff209f..3d5ea1c256be 100644 --- a/src/test/regress/expected/misc_functions.out +++ b/src/test/regress/expected/misc_functions.out @@ -785,7 +785,7 @@ SELECT t.relname AS toastrel FROM pg_class c WHERE c.relname = 'test_chunk_id' \gset SELECT pg_column_toast_chunk_id(a) IS NULL, - pg_column_toast_chunk_id(b) IN (SELECT chunk_id FROM pg_toast.:toastrel) + pg_column_toast_chunk_id(b) IN (SELECT chunk_id::oid8 FROM pg_toast.:toastrel) FROM test_chunk_id; ?column? | ?column? ----------+---------- diff --git a/src/test/regress/sql/misc_functions.sql b/src/test/regress/sql/misc_functions.sql index 946ee5726cdd..7ce6ad62f090 100644 --- a/src/test/regress/sql/misc_functions.sql +++ b/src/test/regress/sql/misc_functions.sql @@ -316,7 +316,7 @@ SELECT t.relname AS toastrel FROM pg_class c WHERE c.relname = 'test_chunk_id' \gset SELECT pg_column_toast_chunk_id(a) IS NULL, - pg_column_toast_chunk_id(b) IN (SELECT chunk_id FROM pg_toast.:toastrel) + pg_column_toast_chunk_id(b) IN (SELECT chunk_id::oid8 FROM pg_toast.:toastrel) FROM test_chunk_id; DROP TABLE test_chunk_id; diff --git a/doc/src/sgml/func/func-admin.sgml b/doc/src/sgml/func/func-admin.sgml index 72038fc835f4..1cbc97917d24 100644 --- a/doc/src/sgml/func/func-admin.sgml +++ b/doc/src/sgml/func/func-admin.sgml @@ -1590,7 +1590,7 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset pg_column_toast_chunk_id pg_column_toast_chunk_id ( "any" ) - oid + oid8 Shows the chunk_id of an on-disk -- 2.54.0