1CREATE TABLE test1 (a int8, b text);
2INSERT INTO test1 VALUES (72057594037927937, 'text');
3CREATE INDEX test1_a_idx ON test1 USING btree (a);
4\x
5SELECT * FROM bt_metap('test1_a_idx');
6-[ RECORD 1 ]-----------+-------
7magic                   | 340322
8version                 | 4
9root                    | 1
10level                   | 0
11fastroot                | 1
12fastlevel               | 0
13oldest_xact             | 0
14last_cleanup_num_tuples | -1
15allequalimage           | t
16
17SELECT * FROM bt_page_stats('test1_a_idx', 0);
18ERROR:  block 0 is a meta page
19SELECT * FROM bt_page_stats('test1_a_idx', 1);
20-[ RECORD 1 ]-+-----
21blkno         | 1
22type          | l
23live_items    | 1
24dead_items    | 0
25avg_item_size | 16
26page_size     | 8192
27free_size     | 8128
28btpo_prev     | 0
29btpo_next     | 0
30btpo          | 0
31btpo_flags    | 3
32
33SELECT * FROM bt_page_stats('test1_a_idx', 2);
34ERROR:  block number out of range
35SELECT * FROM bt_page_items('test1_a_idx', 0);
36ERROR:  block 0 is a meta page
37SELECT * FROM bt_page_items('test1_a_idx', 1);
38-[ RECORD 1 ]-----------------------
39itemoffset | 1
40ctid       | (0,1)
41itemlen    | 16
42nulls      | f
43vars       | f
44data       | 01 00 00 00 00 00 00 01
45dead       | f
46htid       | (0,1)
47tids       |
48
49SELECT * FROM bt_page_items('test1_a_idx', 2);
50ERROR:  block number out of range
51SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 0));
52ERROR:  block is a meta page
53SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 1));
54-[ RECORD 1 ]-----------------------
55itemoffset | 1
56ctid       | (0,1)
57itemlen    | 16
58nulls      | f
59vars       | f
60data       | 01 00 00 00 00 00 00 01
61dead       | f
62htid       | (0,1)
63tids       |
64
65SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 2));
66ERROR:  block number 2 is out of range for relation "test1_a_idx"
67DROP TABLE test1;
68