psql: Improve tab-completion for MERGE.
[pgsql.git] / contrib / pageinspect / expected / btree.out
blob035a81a75923058f6df998596adc47095add6169
1 CREATE TABLE test1 (a int8, b int4range);
2 INSERT INTO test1 VALUES (72057594037927937, '[0,1)');
3 CREATE INDEX test1_a_idx ON test1 USING btree (a);
4 \x
5 SELECT * FROM bt_metap('test1_a_idx');
6 -[ RECORD 1 ]-------------+-------
7 magic                     | 340322
8 version                   | 4
9 root                      | 1
10 level                     | 0
11 fastroot                  | 1
12 fastlevel                 | 0
13 last_cleanup_num_delpages | 0
14 last_cleanup_num_tuples   | -1
15 allequalimage             | t
17 SELECT * FROM bt_page_stats('test1_a_idx', -1);
18 ERROR:  invalid block number
19 SELECT * FROM bt_page_stats('test1_a_idx', 0);
20 ERROR:  block 0 is a meta page
21 SELECT * FROM bt_page_stats('test1_a_idx', 1);
22 -[ RECORD 1 ]-+-----
23 blkno         | 1
24 type          | l
25 live_items    | 1
26 dead_items    | 0
27 avg_item_size | 16
28 page_size     | 8192
29 free_size     | 8128
30 btpo_prev     | 0
31 btpo_next     | 0
32 btpo_level    | 0
33 btpo_flags    | 3
35 SELECT * FROM bt_page_stats('test1_a_idx', 2);
36 ERROR:  block number out of range
37 SELECT * FROM bt_page_items('test1_a_idx', -1);
38 ERROR:  invalid block number
39 SELECT * FROM bt_page_items('test1_a_idx', 0);
40 ERROR:  block 0 is a meta page
41 SELECT * FROM bt_page_items('test1_a_idx', 1);
42 -[ RECORD 1 ]-----------------------
43 itemoffset | 1
44 ctid       | (0,1)
45 itemlen    | 16
46 nulls      | f
47 vars       | f
48 data       | 01 00 00 00 00 00 00 01
49 dead       | f
50 htid       | (0,1)
51 tids       | 
53 SELECT * FROM bt_page_items('test1_a_idx', 2);
54 ERROR:  block number out of range
55 SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', -1));
56 ERROR:  invalid block number
57 SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 0));
58 ERROR:  block is a meta page
59 SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 1));
60 -[ RECORD 1 ]-----------------------
61 itemoffset | 1
62 ctid       | (0,1)
63 itemlen    | 16
64 nulls      | f
65 vars       | f
66 data       | 01 00 00 00 00 00 00 01
67 dead       | f
68 htid       | (0,1)
69 tids       | 
71 SELECT * FROM bt_page_items(get_raw_page('test1_a_idx', 2));
72 ERROR:  block number 2 is out of range for relation "test1_a_idx"
73 -- Failure when using a non-btree index.
74 CREATE INDEX test1_a_hash ON test1 USING hash(a);
75 SELECT bt_metap('test1_a_hash');
76 ERROR:  "test1_a_hash" is not a btree index
77 SELECT bt_page_stats('test1_a_hash', 0);
78 ERROR:  "test1_a_hash" is not a btree index
79 SELECT bt_page_items('test1_a_hash', 0);
80 ERROR:  "test1_a_hash" is not a btree index
81 SELECT bt_page_items(get_raw_page('test1_a_hash', 0));
82 ERROR:  block is a meta page
83 CREATE INDEX test1_b_gist ON test1 USING gist(b);
84 -- Special area of GiST is the same as btree, this complains about inconsistent
85 -- leaf data on the page.
86 SELECT bt_page_items(get_raw_page('test1_b_gist', 0));
87 ERROR:  block is not a valid btree leaf page
88 -- Several failure modes.
89 -- Suppress the DETAIL message, to allow the tests to work across various
90 -- page sizes and architectures.
91 \set VERBOSITY terse
92 -- invalid page size
93 SELECT bt_page_items('aaa'::bytea);
94 ERROR:  invalid page size
95 -- invalid special area size
96 CREATE INDEX test1_a_brin ON test1 USING brin(a);
97 SELECT bt_page_items(get_raw_page('test1', 0));
98 ERROR:  input page is not a valid btree page
99 SELECT bt_page_items(get_raw_page('test1_a_brin', 0));
100 ERROR:  input page is not a valid btree page
101 \set VERBOSITY default
102 -- Tests with all-zero pages.
103 SHOW block_size \gset
104 SELECT bt_page_items(decode(repeat('00', :block_size), 'hex'));
105 -[ RECORD 1 ]-+-
106 bt_page_items | 
108 DROP TABLE test1;