Thank you for your comments!
I updated the patch to use RELKIND_HAS_STORAGE() as done in
commit 4623d7144. Please see the v2-0001 patch for the changes.
On 2025-05-15 19:57, Richard Guo wrote:
+1. FWIW, not long ago we fixed a similar Assert failure in
contrib/pg_freespacemap by verifying RELKIND_HAS_STORAGE() before
trying to access the storage (see 4623d7144). Wondering if there are
other similar issues elsewhere in contrib ...
I tested all contrib functions that take regclass arguments (see
attached test.sql and test_result.txt). The result shows that only
pg_prewarm() can lead to the assertion failure.
However, I found that amcheck's error messages can be misleading
when run on partitioned indexes.
For example, on the master branch, amcheck (e.g., bt_index_check
function)
shows this error:
> ERROR: expected "btree" index as targets for verification
> DETAIL: Relation "pgbench_accounts_pkey" is a btree index.
This message says it expects a "btree" index, yet also states the
relation
is a "btree" index, which can seem contradictory. The actual issue is
that
the index is a btree partitioned index, but this detail is missing,
causing
possible confusion.
Therefore, I thought it would be better to update the detailed message
as shown in the v2-0002 patch:
* master with 0002 patch
> ERROR: expected "btree" index as targets for verification
> DETAIL: Relation "pgbench_accounts_pkey" is a btree partitioned
index.
Regards,
--
Masahiro Ikeda
NTT DATA CORPORATION
-- 1. prepare
-- pgbench -i -s --partition=3
-- 2. check functions which has regclass arguments
-- prewarm
CREATE EXTENSION IF NOT EXISTS pg_prewarm;
SELECT pg_prewarm('pgbench_accounts');
SELECT pg_prewarm('pgbench_accounts_1');
SELECT pg_prewarm('pgbench_accounts_pkey');
SELECT pg_prewarm('pgbench_accounts_1_pkey');
-- amcheck
CREATE EXTENSION IF NOT EXISTS amcheck;
SELECT bt_index_check('pgbench_accounts'::regclass, true, true);
SELECT bt_index_check('pgbench_accounts_1'::regclass, true, true);
SELECT bt_index_check('pgbench_accounts_pkey'::regclass, true, true);
SELECT bt_index_check('pgbench_accounts_1_pkey'::regclass, true, true);
SELECT bt_index_parent_check('pgbench_accounts'::regclass, true, true);
SELECT bt_index_parent_check('pgbench_accounts_1'::regclass, true, true);
SELECT bt_index_parent_check('pgbench_accounts_pkey'::regclass, true, true);
SELECT bt_index_parent_check('pgbench_accounts_1_pkey'::regclass, true, true);
SELECT gin_index_check('pgbench_accounts'::regclass);
SELECT gin_index_check('pgbench_accounts_1'::regclass);
SELECT gin_index_check('pgbench_accounts_pkey'::regclass);
SELECT gin_index_check('pgbench_accounts_1_pkey'::regclass);
SELECT verify_heapam('pgbench_accounts'::regclass);
SELECT verify_heapam('pgbench_accounts_1'::regclass);
SELECT verify_heapam('pgbench_accounts_pkey'::regclass);
SELECT verify_heapam('pgbench_accounts_1_pkey'::regclass);
-- brin
SELECT brin_summarize_new_values('pgbench_accounts'::regclass);
SELECT brin_summarize_new_values('pgbench_accounts_1'::regclass);
SELECT brin_summarize_new_values('pgbench_accounts_pkey'::regclass);
SELECT brin_summarize_new_values('pgbench_accounts_1_pkey'::regclass);
SELECT brin_summarize_range('pgbench_accounts'::regclass, 1);
SELECT brin_summarize_range('pgbench_accounts_1'::regclass, 1);
SELECT brin_summarize_range('pgbench_accounts_pkey'::regclass, 1);
SELECT brin_summarize_range('pgbench_accounts_1_pkey'::regclass, 1);
SELECT brin_desummarize_range('pgbench_accounts'::regclass, 1);
SELECT brin_desummarize_range('pgbench_accounts_1'::regclass, 1);
SELECT brin_desummarize_range('pgbench_accounts_pkey'::regclass, 1);
SELECT brin_desummarize_range('pgbench_accounts_1_pkey'::regclass, 1);
-- pageinspect
CREATE EXTENSION IF NOT EXISTS pageinspect;
SELECT tuple_data_split(
'pgbench_accounts'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
SELECT tuple_data_split(
'pgbench_accounts_1'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
SELECT tuple_data_split(
'pgbench_accounts_pkey'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
SELECT tuple_data_split(
'pgbench_accounts_1_pkey'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts', 0),
'pgbench_accounts'::regclass
) LIMIT 1;
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_1', 0),
'pgbench_accounts_1'::regclass
) LIMIT 1;
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_pkey', 0),
'pgbench_accounts_pkey'::regclass
) LIMIT 1;
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_1_pkey', 0),
'pgbench_accounts_1_pkey'::regclass
) LIMIT 1;
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts', 1),
'pgbench_accounts'::regclass
);
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_1', 1),
'pgbench_accounts_1'::regclass
);
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_pkey', 1),
'pgbench_accounts_pkey'::regclass
);
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_1_pkey', 1),
'pgbench_accounts_1_pkey'::regclass
);
-- pgstattuple
CREATE EXTENSION IF NOT EXISTS pgstattuple;
SELECT * FROM pgstattuple('pgbench_accounts');
SELECT * FROM pgstattuple('pgbench_accounts_1');
SELECT * FROM pgstattuple('pgbench_accounts_pkey');
SELECT * FROM pgstattuple('pgbench_accounts_1_pkey');
SELECT * FROM pgstatindex('pgbench_accounts_pkey');
SELECT * FROM pgstatindex('pgbench_accounts_1_pkey');
SELECT * FROM pgstatindex('pgbench_accounts');
SELECT * FROM pgstatindex('pgbench_accounts_1');
SELECT * FROM pgstatginindex('pgbench_accounts_pkey');
SELECT * FROM pgstatginindex('pgbench_accounts_1_pkey');
SELECT * FROM pgstatginindex('pgbench_accounts');
SELECT * FROM pgstatginindex('pgbench_accounts_1');
SELECT * FROM pgstathashindex('pgbench_accounts_pkey');
SELECT * FROM pgstathashindex('pgbench_accounts_1_pkey');
SELECT * FROM pgstathashindex('pgbench_accounts');
SELECT * FROM pgstathashindex('pgbench_accounts_1');
SELECT pg_relpages('pgbench_accounts');
SELECT pg_relpages('pgbench_accounts_1');
SELECT pg_relpages('pgbench_accounts_pkey');
SELECT pg_relpages('pgbench_accounts_1_pkey');
SELECT * FROM pgstattuple_approx('pgbench_accounts');
SELECT * FROM pgstattuple_approx('pgbench_accounts_1');
SELECT * FROM pgstattuple_approx('pgbench_accounts_pkey');
SELECT * FROM pgstattuple_approx('pgbench_accounts_1_pkey');
-- pg_surgery
CREATE EXTENSION IF NOT EXISTS pg_surgery;
SELECT heap_force_kill('pgbench_accounts', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_kill('pgbench_accounts_1', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_kill('pgbench_accounts_pkey', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_kill('pgbench_accounts_1_pkey', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_freeze('pgbench_accounts', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_freeze('pgbench_accounts_1', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_freeze('pgbench_accounts_pkey', ARRAY['(0, 1)']::tid[]);
SELECT heap_force_freeze('pgbench_accounts_1_pkey', ARRAY['(0, 1)']::tid[]);
-- pg_visibility
CREATE EXTENSION IF NOT EXISTS pg_visibility;
SELECT * FROM pg_visibility_map('pgbench_accounts') LIMIT 1;
SELECT * FROM pg_visibility_map('pgbench_accounts_1') LIMIT 1;
SELECT * FROM pg_visibility_map('pgbench_accounts_pkey') LIMIT 1;
SELECT * FROM pg_visibility_map('pgbench_accounts_1_pkey') LIMIT 1;
SELECT * FROM pg_visibility('pgbench_accounts') LIMIT 1;
SELECT * FROM pg_visibility('pgbench_accounts_1') LIMIT 1;
SELECT * FROM pg_visibility('pgbench_accounts_pkey') LIMIT 1;
SELECT * FROM pg_visibility('pgbench_accounts_1_pkey') LIMIT 1;
SELECT * FROM pg_visibility_map_summary('pgbench_accounts');
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_1');
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_pkey');
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_1_pkey');
SELECT * FROM pg_check_frozen('pgbench_accounts');
SELECT * FROM pg_check_frozen('pgbench_accounts_1');
SELECT * FROM pg_check_frozen('pgbench_accounts_pkey');
SELECT * FROM pg_check_frozen('pgbench_accounts_1_pkey');
SELECT * FROM pg_check_visible('pgbench_accounts');
SELECT * FROM pg_check_visible('pgbench_accounts_1');
SELECT * FROM pg_check_visible('pgbench_accounts_pkey');
SELECT * FROM pg_check_visible('pgbench_accounts_1_pkey');
SELECT pg_truncate_visibility_map('pgbench_accounts');
SELECT pg_truncate_visibility_map('pgbench_accounts_1');
SELECT pg_truncate_visibility_map('pgbench_accounts_pkey');
SELECT pg_truncate_visibility_map('pgbench_accounts_1_pkey');
From db240142ab4de334ef072f6af59a792701e806c5 Mon Sep 17 00:00:00 2001
From: Masahiro Ikeda <ikeda...@oss.nttdata.com>
Date: Fri, 16 May 2025 14:35:32 +0900
Subject: [PATCH v2 1/2] Fix assertion failure when pg_prewarm() is run on
objects that don't have storage.
This issue was introduced by commit 049ef33.
Specifying objects that don't have storage as an argument to
pg_prewarm() could trigger an assertion failure:
Failed Assert("RelFileNumberIsValid(rlocator.relNumber)")
This fix ensures that such cases are handled appropriately.
---
contrib/pg_prewarm/pg_prewarm.c | 8 ++++++++
contrib/pg_prewarm/t/001_basic.pl | 11 ++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/contrib/pg_prewarm/pg_prewarm.c b/contrib/pg_prewarm/pg_prewarm.c
index 50808569bd7..1f89c9adc86 100644
--- a/contrib/pg_prewarm/pg_prewarm.c
+++ b/contrib/pg_prewarm/pg_prewarm.c
@@ -112,6 +112,14 @@ pg_prewarm(PG_FUNCTION_ARGS)
if (aclresult != ACLCHECK_OK)
aclcheck_error(aclresult, get_relkind_objtype(rel->rd_rel->relkind), get_rel_name(relOid));
+ /* Check that the storage exists. */
+ if (!RELKIND_HAS_STORAGE(rel->rd_rel->relkind))
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("relation \"%s\" does not have storage",
+ RelationGetRelationName(rel)),
+ errdetail_relkind_not_supported(rel->rd_rel->relkind)));
+
/* Check that the fork exists. */
if (!smgrexists(RelationGetSmgr(rel), forkNumber))
ereport(ERROR,
diff --git a/contrib/pg_prewarm/t/001_basic.pl b/contrib/pg_prewarm/t/001_basic.pl
index 0a8259d3678..f7c31ae60a8 100644
--- a/contrib/pg_prewarm/t/001_basic.pl
+++ b/contrib/pg_prewarm/t/001_basic.pl
@@ -23,7 +23,10 @@ $node->start;
$node->safe_psql("postgres",
"CREATE EXTENSION pg_prewarm;\n"
. "CREATE TABLE test(c1 int);\n"
- . "INSERT INTO test SELECT generate_series(1, 100);");
+ . "INSERT INTO test SELECT generate_series(1, 100);\n"
+ . "CREATE TABLE test_part(c1 int) PARTITION BY RANGE (c1);\n"
+ . "CREATE TABLE test_part1 PARTITION OF test_part FOR VALUES FROM (1) TO (1000);\n"
+ . "INSERT INTO test_part SELECT generate_series(1, 100);");
# test read mode
my $result =
@@ -42,6 +45,12 @@ ok( ( $stdout =~ qr/^[1-9][0-9]*$/
or $stderr =~ qr/prefetch is not supported by this build/),
'prefetch mode succeeded');
+# test partition table
+($cmdret, $stdout, $stderr) =
+ $node->psql("postgres", "SELECT pg_prewarm('test_part', 'buffer');");
+ok( $stderr =~ /relation "test_part" does not have storage/,
+ 'detected storage does not exist');
+
# test autoprewarm_dump_now()
$result = $node->safe_psql("postgres", "SELECT autoprewarm_dump_now();");
like($result, qr/^[1-9][0-9]*$/, 'autoprewarm_dump_now succeeded');
--
2.34.1
From 83f92645ff1f934e7960534c32ad2d67b2f0b910 Mon Sep 17 00:00:00 2001
From: Masahiro Ikeda <ikeda...@oss.nttdata.com>
Date: Fri, 16 May 2025 14:41:27 +0900
Subject: [PATCH v2 2/2] Fix error message details for partitioned indexes in
amcheck
Until now, the error detail could be misleading when bt_index_check()
is run on partitioned indexes. For example, the index
"pgbench_accounts_pkey" is both a btree and a partitioned index.
Before this change, the error message was:
> ERROR: expected "btree" index as targets for verification
> DETAIL: Relation "pgbench_accounts_pkey" is a btree index.
This change adds the word "partitioned" to the error detail to avoid
confusion about why the error occurred.
After this change, the error message becomes:
> ERROR: expected "btree" index as targets for verification
> DETAIL: Relation "pgbench_accounts_pkey" is a btree partitioned index.
---
contrib/amcheck/verify_common.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/contrib/amcheck/verify_common.c b/contrib/amcheck/verify_common.c
index d095e62ce55..b68ddaf895d 100644
--- a/contrib/amcheck/verify_common.c
+++ b/contrib/amcheck/verify_common.c
@@ -169,8 +169,9 @@ index_checkable(Relation rel, Oid am_id)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("expected \"%s\" index as targets for verification", NameStr(((Form_pg_am) GETSTRUCT(amtup))->amname)),
- errdetail("Relation \"%s\" is a %s index.",
- RelationGetRelationName(rel), NameStr(((Form_pg_am) GETSTRUCT(amtuprel))->amname))));
+ errdetail("Relation \"%s\" is a %s %sindex.",
+ RelationGetRelationName(rel), NameStr(((Form_pg_am) GETSTRUCT(amtuprel))->amname),
+ (rel->rd_rel->relkind == RELKIND_PARTITIONED_INDEX) ? "partitioned " : "")));
}
if (RELATION_IS_OTHER_TEMP(rel))
--
2.34.1
CREATE EXTENSION IF NOT EXISTS pg_prewarm;
psql:test.sql:7: NOTICE: extension "pg_prewarm" already exists, skipping
CREATE EXTENSION
SELECT pg_prewarm('pgbench_accounts');
psql:test.sql:9: ERROR: relation "pgbench_accounts" does not have storage
DETAIL: This operation is not supported for partitioned tables.
SELECT pg_prewarm('pgbench_accounts_1');
pg_prewarm
------------
580
(1 row)
SELECT pg_prewarm('pgbench_accounts_pkey');
psql:test.sql:11: ERROR: relation "pgbench_accounts_pkey" does not have storage
DETAIL: This operation is not supported for partitioned indexes.
SELECT pg_prewarm('pgbench_accounts_1_pkey');
pg_prewarm
------------
94
(1 row)
CREATE EXTENSION IF NOT EXISTS amcheck;
psql:test.sql:15: NOTICE: extension "amcheck" already exists, skipping
CREATE EXTENSION
SELECT bt_index_check('pgbench_accounts'::regclass, true, true);
psql:test.sql:16: ERROR: "pgbench_accounts" is not an index
SELECT bt_index_check('pgbench_accounts_1'::regclass, true, true);
psql:test.sql:17: ERROR: "pgbench_accounts_1" is not an index
SELECT bt_index_check('pgbench_accounts_pkey'::regclass, true, true);
psql:test.sql:18: ERROR: expected "btree" index as targets for verification
DETAIL: Relation "pgbench_accounts_pkey" is a btree index.
SELECT bt_index_check('pgbench_accounts_1_pkey'::regclass, true, true);
bt_index_check
----------------
(1 row)
SELECT bt_index_parent_check('pgbench_accounts'::regclass, true, true);
psql:test.sql:21: ERROR: "pgbench_accounts" is not an index
SELECT bt_index_parent_check('pgbench_accounts_1'::regclass, true, true);
psql:test.sql:22: ERROR: "pgbench_accounts_1" is not an index
SELECT bt_index_parent_check('pgbench_accounts_pkey'::regclass, true, true);
psql:test.sql:23: ERROR: expected "btree" index as targets for verification
DETAIL: Relation "pgbench_accounts_pkey" is a btree index.
SELECT bt_index_parent_check('pgbench_accounts_1_pkey'::regclass, true, true);
bt_index_parent_check
-----------------------
(1 row)
SELECT gin_index_check('pgbench_accounts'::regclass);
psql:test.sql:26: ERROR: "pgbench_accounts" is not an index
SELECT gin_index_check('pgbench_accounts_1'::regclass);
psql:test.sql:27: ERROR: "pgbench_accounts_1" is not an index
SELECT gin_index_check('pgbench_accounts_pkey'::regclass);
psql:test.sql:28: ERROR: expected "gin" index as targets for verification
DETAIL: Relation "pgbench_accounts_pkey" is a btree index.
SELECT gin_index_check('pgbench_accounts_1_pkey'::regclass);
psql:test.sql:29: ERROR: expected "gin" index as targets for verification
DETAIL: Relation "pgbench_accounts_1_pkey" is a btree index.
SELECT verify_heapam('pgbench_accounts'::regclass);
psql:test.sql:31: ERROR: cannot check relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT verify_heapam('pgbench_accounts_1'::regclass);
verify_heapam
---------------
(0 rows)
SELECT verify_heapam('pgbench_accounts_pkey'::regclass);
psql:test.sql:33: ERROR: cannot check relation "pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT verify_heapam('pgbench_accounts_1_pkey'::regclass);
psql:test.sql:34: ERROR: cannot check relation "pgbench_accounts_1_pkey"
DETAIL: This operation is not supported for indexes.
SELECT brin_summarize_new_values('pgbench_accounts'::regclass);
psql:test.sql:37: ERROR: "pgbench_accounts" is not an index
SELECT brin_summarize_new_values('pgbench_accounts_1'::regclass);
psql:test.sql:38: ERROR: "pgbench_accounts_1" is not an index
SELECT brin_summarize_new_values('pgbench_accounts_pkey'::regclass);
psql:test.sql:39: ERROR: "pgbench_accounts_pkey" is not a BRIN index
SELECT brin_summarize_new_values('pgbench_accounts_1_pkey'::regclass);
psql:test.sql:40: ERROR: "pgbench_accounts_1_pkey" is not a BRIN index
SELECT brin_summarize_range('pgbench_accounts'::regclass, 1);
psql:test.sql:42: ERROR: "pgbench_accounts" is not an index
SELECT brin_summarize_range('pgbench_accounts_1'::regclass, 1);
psql:test.sql:43: ERROR: "pgbench_accounts_1" is not an index
SELECT brin_summarize_range('pgbench_accounts_pkey'::regclass, 1);
psql:test.sql:44: ERROR: "pgbench_accounts_pkey" is not a BRIN index
SELECT brin_summarize_range('pgbench_accounts_1_pkey'::regclass, 1);
psql:test.sql:45: ERROR: "pgbench_accounts_1_pkey" is not a BRIN index
SELECT brin_desummarize_range('pgbench_accounts'::regclass, 1);
psql:test.sql:47: ERROR: "pgbench_accounts" is not an index
SELECT brin_desummarize_range('pgbench_accounts_1'::regclass, 1);
psql:test.sql:48: ERROR: "pgbench_accounts_1" is not an index
SELECT brin_desummarize_range('pgbench_accounts_pkey'::regclass, 1);
psql:test.sql:49: ERROR: "pgbench_accounts_pkey" is not a BRIN index
SELECT brin_desummarize_range('pgbench_accounts_1_pkey'::regclass, 1);
psql:test.sql:50: ERROR: "pgbench_accounts_1_pkey" is not a BRIN index
CREATE EXTENSION IF NOT EXISTS pageinspect;
psql:test.sql:53: NOTICE: extension "pageinspect" already exists, skipping
CREATE EXTENSION
SELECT tuple_data_split(
'pgbench_accounts'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
psql:test.sql:59: ERROR: only heap AM is supported
SELECT tuple_data_split(
'pgbench_accounts_1'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
tuple_data_split
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{"\\x7b000000","\\x01000000","\\x00000000","\\xab202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020"}
(1 row)
SELECT tuple_data_split(
'pgbench_accounts_pkey'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
psql:test.sql:69: ERROR: only heap AM is supported
SELECT tuple_data_split(
'pgbench_accounts_1_pkey'::regclass,
t_data, t_infomask, t_infomask2, t_bits
)
FROM heap_page_items(get_raw_page('pgbench_accounts_1', 2)) LIMIT 1;
psql:test.sql:74: ERROR: only heap AM is supported
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts', 0),
'pgbench_accounts'::regclass
) LIMIT 1;
psql:test.sql:79: ERROR: cannot get raw page from relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_1', 0),
'pgbench_accounts_1'::regclass
) LIMIT 1;
lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid |
t_infomask2 | t_infomask | t_hoff | t_bits | t_oid |
t_attrs
----+--------+----------+--------+--------+--------+----------+--------+-------------+------------+--------+--------+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | 8064 | 1 | 121 | 766 | 0 | 8 | (0,1) |
4 | 2306 | 24 | | |
{"\\x01000000","\\x01000000","\\x00000000","\\xab202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020"}
(1 row)
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_pkey', 0),
'pgbench_accounts_pkey'::regclass
) LIMIT 1;
psql:test.sql:87: ERROR: cannot get raw page from relation
"pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM heap_page_item_attrs(
get_raw_page('pgbench_accounts_1_pkey', 0),
'pgbench_accounts_1_pkey'::regclass
) LIMIT 1;
lp | lp_off | lp_flags | lp_len | t_xmin | t_xmax | t_field3 | t_ctid |
t_infomask2 | t_infomask | t_hoff | t_bits | t_oid | t_attrs
----+--------+----------+--------+--------+--------+----------+--------+-------------+------------+--------+--------+-------+---------
1 | 12642 | 2 | 2 | | | | |
| | | | |
(1 row)
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts', 1),
'pgbench_accounts'::regclass
);
psql:test.sql:96: ERROR: cannot get raw page from relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_1', 1),
'pgbench_accounts_1'::regclass
);
psql:test.sql:100: ERROR: "pgbench_accounts_1" is not an index
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_pkey', 1),
'pgbench_accounts_pkey'::regclass
);
psql:test.sql:104: ERROR: cannot get raw page from relation
"pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM gist_page_items(
get_raw_page('pgbench_accounts_1_pkey', 1),
'pgbench_accounts_1_pkey'::regclass
);
psql:test.sql:108: ERROR: "pgbench_accounts_1_pkey" is not a GiST index
CREATE EXTENSION IF NOT EXISTS pgstattuple;
psql:test.sql:111: NOTICE: extension "pgstattuple" already exists, skipping
CREATE EXTENSION
SELECT * FROM pgstattuple('pgbench_accounts');
psql:test.sql:113: ERROR: cannot get tuple-level statistics for relation
"pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pgstattuple('pgbench_accounts_1');
table_len | tuple_count | tuple_len | tuple_percent | dead_tuple_count |
dead_tuple_len | dead_tuple_percent | free_space | free_percent
-----------+-------------+-----------+---------------+------------------+----------------+--------------------+------------+--------------
4751360 | 33334 | 4033414 | 84.89 | 0 |
0 | 0 | 67808 | 1.43
(1 row)
SELECT * FROM pgstattuple('pgbench_accounts_pkey');
psql:test.sql:115: ERROR: cannot get tuple-level statistics for relation
"pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pgstattuple('pgbench_accounts_1_pkey');
table_len | tuple_count | tuple_len | tuple_percent | dead_tuple_count |
dead_tuple_len | dead_tuple_percent | free_space | free_percent
-----------+-------------+-----------+---------------+------------------+----------------+--------------------+------------+--------------
770048 | 33334 | 533344 | 69.26 | 0 |
0 | 0 | 81484 | 10.58
(1 row)
SELECT * FROM pgstatindex('pgbench_accounts_pkey');
psql:test.sql:118: ERROR: relation "pgbench_accounts_pkey" is not a btree index
SELECT * FROM pgstatindex('pgbench_accounts_1_pkey');
version | tree_level | index_size | root_block_no | internal_pages |
leaf_pages | empty_pages | deleted_pages | avg_leaf_density |
leaf_fragmentation
---------+------------+------------+---------------+----------------+------------+-------------+---------------+------------------+--------------------
4 | 1 | 770048 | 3 | 1 |
92 | 0 | 0 | 89.14 | 0
(1 row)
SELECT * FROM pgstatindex('pgbench_accounts');
psql:test.sql:120: ERROR: relation "pgbench_accounts" is not a btree index
SELECT * FROM pgstatindex('pgbench_accounts_1');
psql:test.sql:121: ERROR: relation "pgbench_accounts_1" is not a btree index
SELECT * FROM pgstatginindex('pgbench_accounts_pkey');
psql:test.sql:123: ERROR: relation "pgbench_accounts_pkey" is not a GIN index
SELECT * FROM pgstatginindex('pgbench_accounts_1_pkey');
psql:test.sql:124: ERROR: relation "pgbench_accounts_1_pkey" is not a GIN index
SELECT * FROM pgstatginindex('pgbench_accounts');
psql:test.sql:125: ERROR: relation "pgbench_accounts" is not a GIN index
SELECT * FROM pgstatginindex('pgbench_accounts_1');
psql:test.sql:126: ERROR: relation "pgbench_accounts_1" is not a GIN index
SELECT * FROM pgstathashindex('pgbench_accounts_pkey');
psql:test.sql:128: ERROR: relation "pgbench_accounts_pkey" is not a hash index
SELECT * FROM pgstathashindex('pgbench_accounts_1_pkey');
psql:test.sql:129: ERROR: relation "pgbench_accounts_1_pkey" is not a hash
index
SELECT * FROM pgstathashindex('pgbench_accounts');
psql:test.sql:130: ERROR: relation "pgbench_accounts" is not a hash index
SELECT * FROM pgstathashindex('pgbench_accounts_1');
psql:test.sql:131: ERROR: relation "pgbench_accounts_1" is not a hash index
SELECT pg_relpages('pgbench_accounts');
psql:test.sql:133: ERROR: cannot get page count of relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT pg_relpages('pgbench_accounts_1');
pg_relpages
-------------
580
(1 row)
SELECT pg_relpages('pgbench_accounts_pkey');
psql:test.sql:135: ERROR: cannot get page count of relation
"pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT pg_relpages('pgbench_accounts_1_pkey');
pg_relpages
-------------
94
(1 row)
SELECT * FROM pgstattuple_approx('pgbench_accounts');
psql:test.sql:138: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pgstattuple_approx('pgbench_accounts_1');
table_len | scanned_percent | approx_tuple_count | approx_tuple_len |
approx_tuple_percent | dead_tuple_count | dead_tuple_len | dead_tuple_percent |
approx_free_space | approx_free_percent
-----------+-------------------+--------------------+------------------+----------------------+------------------+----------------+--------------------+-------------------+---------------------
4751360 | 5.689655172413793 | 31437 | 4424160 |
93.11355064655173 | 0 | 0 | 0 |
56864 | 1.1967941810344827
(1 row)
SELECT * FROM pgstattuple_approx('pgbench_accounts_pkey');
psql:test.sql:140: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pgstattuple_approx('pgbench_accounts_1_pkey');
psql:test.sql:141: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
CREATE EXTENSION IF NOT EXISTS pg_surgery;
psql:test.sql:144: NOTICE: extension "pg_surgery" already exists, skipping
CREATE EXTENSION
SELECT heap_force_kill('pgbench_accounts', ARRAY['(0, 1)']::tid[]);
psql:test.sql:145: ERROR: cannot operate on relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT heap_force_kill('pgbench_accounts_1', ARRAY['(0, 1)']::tid[]);
heap_force_kill
-----------------
(1 row)
SELECT heap_force_kill('pgbench_accounts_pkey', ARRAY['(0, 1)']::tid[]);
psql:test.sql:147: ERROR: cannot operate on relation "pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT heap_force_kill('pgbench_accounts_1_pkey', ARRAY['(0, 1)']::tid[]);
psql:test.sql:148: ERROR: cannot operate on relation "pgbench_accounts_1_pkey"
DETAIL: This operation is not supported for indexes.
SELECT heap_force_freeze('pgbench_accounts', ARRAY['(0, 1)']::tid[]);
psql:test.sql:150: ERROR: cannot operate on relation "pgbench_accounts"
DETAIL: This operation is not supported for partitioned tables.
SELECT heap_force_freeze('pgbench_accounts_1', ARRAY['(0, 1)']::tid[]);
psql:test.sql:151: NOTICE: skipping tid (0, 1) for relation
"pgbench_accounts_1" because it is marked dead
heap_force_freeze
-------------------
(1 row)
SELECT heap_force_freeze('pgbench_accounts_pkey', ARRAY['(0, 1)']::tid[]);
psql:test.sql:152: ERROR: cannot operate on relation "pgbench_accounts_pkey"
DETAIL: This operation is not supported for partitioned indexes.
SELECT heap_force_freeze('pgbench_accounts_1_pkey', ARRAY['(0, 1)']::tid[]);
psql:test.sql:153: ERROR: cannot operate on relation "pgbench_accounts_1_pkey"
DETAIL: This operation is not supported for indexes.
CREATE EXTENSION IF NOT EXISTS pg_visibility;
psql:test.sql:156: NOTICE: extension "pg_visibility" already exists, skipping
CREATE EXTENSION
SELECT * FROM pg_visibility_map('pgbench_accounts') LIMIT 1;
psql:test.sql:158: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pg_visibility_map('pgbench_accounts_1') LIMIT 1;
blkno | all_visible | all_frozen
-------+-------------+------------
0 | f | f
(1 row)
SELECT * FROM pg_visibility_map('pgbench_accounts_pkey') LIMIT 1;
psql:test.sql:160: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pg_visibility_map('pgbench_accounts_1_pkey') LIMIT 1;
psql:test.sql:161: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
SELECT * FROM pg_visibility('pgbench_accounts') LIMIT 1;
psql:test.sql:163: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pg_visibility('pgbench_accounts_1') LIMIT 1;
blkno | all_visible | all_frozen | pd_all_visible
-------+-------------+------------+----------------
0 | f | f | f
(1 row)
SELECT * FROM pg_visibility('pgbench_accounts_pkey') LIMIT 1;
psql:test.sql:165: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pg_visibility('pgbench_accounts_1_pkey') LIMIT 1;
psql:test.sql:166: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
SELECT * FROM pg_visibility_map_summary('pgbench_accounts');
psql:test.sql:168: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_1');
all_visible | all_frozen
-------------+------------
546 | 0
(1 row)
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_pkey');
psql:test.sql:170: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pg_visibility_map_summary('pgbench_accounts_1_pkey');
psql:test.sql:171: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
SELECT * FROM pg_check_frozen('pgbench_accounts');
psql:test.sql:173: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pg_check_frozen('pgbench_accounts_1');
t_ctid
--------
(0 rows)
SELECT * FROM pg_check_frozen('pgbench_accounts_pkey');
psql:test.sql:175: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pg_check_frozen('pgbench_accounts_1_pkey');
psql:test.sql:176: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
SELECT * FROM pg_check_visible('pgbench_accounts');
psql:test.sql:178: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT * FROM pg_check_visible('pgbench_accounts_1');
t_ctid
--------
(0 rows)
SELECT * FROM pg_check_visible('pgbench_accounts_pkey');
psql:test.sql:180: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT * FROM pg_check_visible('pgbench_accounts_1_pkey');
psql:test.sql:181: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.
SELECT pg_truncate_visibility_map('pgbench_accounts');
psql:test.sql:183: ERROR: relation "pgbench_accounts" is of wrong relation kind
DETAIL: This operation is not supported for partitioned tables.
SELECT pg_truncate_visibility_map('pgbench_accounts_1');
pg_truncate_visibility_map
----------------------------
(1 row)
SELECT pg_truncate_visibility_map('pgbench_accounts_pkey');
psql:test.sql:185: ERROR: relation "pgbench_accounts_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for partitioned indexes.
SELECT pg_truncate_visibility_map('pgbench_accounts_1_pkey');
psql:test.sql:186: ERROR: relation "pgbench_accounts_1_pkey" is of wrong
relation kind
DETAIL: This operation is not supported for indexes.