mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Commit dae761a87ed modified brin_page_items() to return the new "empty" flag for each BRIN range. But the new output parameter was added in the middle, which may cause crashes when using the new binary with old function definition. The ideal solution would be to introduce API versioning similar to what pg_stat_statements does, but it's too late for that as PG17 was already released (so we can't introduce a new extension version). We could do something similar in brin_page_items() by checking the number of output columns (and ignoring the new flag), but it doesn't seem very nice. Instead, simply error out and suggest updating the extension to the latest version. pageinspect is a superuser-only extension, and there's not much reason to run an older version. Moreover, there's a precedent for this approach in 691e8b2e18. Reported by Ľuboslav Špilák, investigation and patch by me. Backpatch to 17, same as dae761a87ed. Reported-by: Ľuboslav Špilák Reviewed-by: Michael Paquier, Hayato Kuroda, Peter Geoghegan Backpatch-through: 17 Discussion: https://postgr.es/m/VI1PR02MB63331C3D90E2104FD12399D38A5D2@VI1PR02MB6333.eurprd02.prod.outlook.com Discussion: https://postgr.es/m/flat/3385a58f-5484-49d0-b790-9a198a0bf236@vondra.me
36 lines
1.3 KiB
SQL
36 lines
1.3 KiB
SQL
-- test old extension version entry points
|
|
|
|
DROP EXTENSION pageinspect;
|
|
CREATE EXTENSION pageinspect VERSION '1.8';
|
|
|
|
CREATE TABLE test1 (a int8, b text);
|
|
INSERT INTO test1 VALUES (72057594037927937, 'text');
|
|
CREATE INDEX test1_a_idx ON test1 USING btree (a);
|
|
|
|
-- from page.sql
|
|
SELECT octet_length(get_raw_page('test1', 0)) AS main_0;
|
|
SELECT octet_length(get_raw_page('test1', 'main', 0)) AS main_0;
|
|
SELECT page_checksum(get_raw_page('test1', 0), 0) IS NOT NULL AS silly_checksum_test;
|
|
|
|
-- from btree.sql
|
|
SELECT * FROM bt_page_stats('test1_a_idx', 1);
|
|
SELECT * FROM bt_page_items('test1_a_idx', 1);
|
|
|
|
-- page_header() uses int instead of smallint for lower, upper, special and
|
|
-- pagesize in pageinspect >= 1.10.
|
|
ALTER EXTENSION pageinspect UPDATE TO '1.9';
|
|
\df page_header
|
|
SELECT pagesize, version FROM page_header(get_raw_page('test1', 0));
|
|
|
|
-- brin_page_items() added a new "empty" flag in 1.12, make sure we detect
|
|
-- an old function definition
|
|
ALTER EXTENSION pageinspect UPDATE TO '1.11';
|
|
CREATE INDEX test_1_a_brin_idx ON test1 USING BRIN (a);
|
|
SELECT * FROM brin_page_items(get_raw_page('test_1_a_brin_idx', 2), 'test_1_a_brin_idx');
|
|
|
|
ALTER EXTENSION pageinspect UPDATE TO '1.12';
|
|
SELECT * FROM brin_page_items(get_raw_page('test_1_a_brin_idx', 2), 'test_1_a_brin_idx');
|
|
|
|
DROP TABLE test1;
|
|
DROP EXTENSION pageinspect;
|