mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-22 04:43:24 +02:00
Block numbers are 32-bit unsigned integers. Therefore, the smallest SQL integer type that they can fit in is bigint. However, in the pageinspect module, most input and output parameters dealing with block numbers were declared as int. The behavior with block numbers larger than a signed 32-bit integer was therefore dubious. Change these arguments to type bigint and add some more explicit error checking on the block range. (Other contrib modules appear to do this correctly already.) Since we are changing argument types of existing functions, in order to not misbehave if the binary is updated before the extension is updated, we need to create new C symbols for the entry points, similar to how it's done in other extensions as well. Reported-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://www.postgresql.org/message-id/flat/d8f6bdd536df403b9b33816e9f7e0b9d@G08CNEXMBPEKD05.g08.fujitsu.local
21 lines
645 B
SQL
21 lines
645 B
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);
|
|
|
|
DROP TABLE test1;
|
|
DROP EXTENSION pageinspect;
|