]> granicus.if.org Git - postgresql/blob - contrib/pageinspect/expected/page.out
Revert "Avoid creation of the free space map for small heap relations."
[postgresql] / contrib / pageinspect / expected / page.out
1 CREATE EXTENSION pageinspect;
2 CREATE TABLE test1 (a int, b int);
3 INSERT INTO test1 VALUES (16777217, 131584);
4 VACUUM test1;  -- set up FSM
5 -- The page contents can vary, so just test that it can be read
6 -- successfully, but don't keep the output.
7 SELECT octet_length(get_raw_page('test1', 'main', 0)) AS main_0;
8  main_0 
9 --------
10    8192
11 (1 row)
12
13 SELECT octet_length(get_raw_page('test1', 'main', 1)) AS main_1;
14 ERROR:  block number 1 is out of range for relation "test1"
15 SELECT octet_length(get_raw_page('test1', 'fsm', 0)) AS fsm_0;
16  fsm_0 
17 -------
18   8192
19 (1 row)
20
21 SELECT octet_length(get_raw_page('test1', 'fsm', 1)) AS fsm_1;
22  fsm_1 
23 -------
24   8192
25 (1 row)
26
27 SELECT octet_length(get_raw_page('test1', 'vm', 0)) AS vm_0;
28  vm_0 
29 ------
30  8192
31 (1 row)
32
33 SELECT octet_length(get_raw_page('test1', 'vm', 1)) AS vm_1;
34 ERROR:  block number 1 is out of range for relation "test1"
35 SELECT octet_length(get_raw_page('xxx', 'main', 0));
36 ERROR:  relation "xxx" does not exist
37 SELECT octet_length(get_raw_page('test1', 'xxx', 0));
38 ERROR:  invalid fork name
39 HINT:  Valid fork names are "main", "fsm", "vm", and "init".
40 SELECT get_raw_page('test1', 0) = get_raw_page('test1', 'main', 0);
41  ?column? 
42 ----------
43  t
44 (1 row)
45
46 SELECT pagesize, version FROM page_header(get_raw_page('test1', 0));
47  pagesize | version 
48 ----------+---------
49      8192 |       4
50 (1 row)
51
52 SELECT page_checksum(get_raw_page('test1', 0), 0) IS NOT NULL AS silly_checksum_test;
53  silly_checksum_test 
54 ---------------------
55  t
56 (1 row)
57
58 SELECT tuple_data_split('test1'::regclass, t_data, t_infomask, t_infomask2, t_bits)
59     FROM heap_page_items(get_raw_page('test1', 0));
60        tuple_data_split        
61 -------------------------------
62  {"\\x01000001","\\x00020200"}
63 (1 row)
64
65 SELECT * FROM fsm_page_contents(get_raw_page('test1', 'fsm', 0));
66  fsm_page_contents 
67 -------------------
68  0: 254           +
69  1: 254           +
70  3: 254           +
71  7: 254           +
72  15: 254          +
73  31: 254          +
74  63: 254          +
75  127: 254         +
76  255: 254         +
77  511: 254         +
78  1023: 254        +
79  2047: 254        +
80  4095: 254        +
81  fp_next_slot: 0  +
82  
83 (1 row)
84
85 DROP TABLE test1;
86 -- check that using any of these functions with a partitioned table or index
87 -- would fail
88 create table test_partitioned (a int) partition by range (a);
89 create index test_partitioned_index on test_partitioned (a);
90 select get_raw_page('test_partitioned', 0); -- error about partitioned table
91 ERROR:  cannot get raw page from partitioned table "test_partitioned"
92 select get_raw_page('test_partitioned_index', 0); -- error about partitioned index
93 ERROR:  cannot get raw page from partitioned index "test_partitioned_index"
94 -- a regular table which is a member of a partition set should work though
95 create table test_part1 partition of test_partitioned for values from ( 1 ) to (100);
96 select get_raw_page('test_part1', 0); -- get farther and error about empty table
97 ERROR:  block number 0 is out of range for relation "test_part1"
98 drop table test_partitioned;
99 -- check null bitmap alignment for table whose number of attributes is multiple of 8
100 create table test8 (f1 int, f2 int, f3 int, f4 int, f5 int, f6 int, f7 int, f8 int);
101 insert into test8(f1, f8) values (x'7f00007f'::int, 0);
102 select t_bits, t_data from heap_page_items(get_raw_page('test8', 0));
103   t_bits  |       t_data       
104 ----------+--------------------
105  10000001 | \x7f00007f00000000
106 (1 row)
107
108 select tuple_data_split('test8'::regclass, t_data, t_infomask, t_infomask2, t_bits)
109     from heap_page_items(get_raw_page('test8', 0));
110                       tuple_data_split                       
111 -------------------------------------------------------------
112  {"\\x7f00007f",NULL,NULL,NULL,NULL,NULL,NULL,"\\x00000000"}
113 (1 row)
114
115 drop table test8;