3 -- grep 843938989 hash.data
5 SELECT * FROM hash_i4_heap
6 WHERE hash_i4_heap.random = 843938989;
14 -- grep 66766766 hash.data
16 SELECT * FROM hash_i4_heap
17 WHERE hash_i4_heap.random = 66766766;
24 -- grep 1505703298 hash.data
26 SELECT * FROM hash_name_heap
27 WHERE hash_name_heap.random = '1505703298'::name;
35 -- grep 7777777 hash.data
37 SELECT * FROM hash_name_heap
38 WHERE hash_name_heap.random = '7777777'::name;
45 -- grep 1351610853 hash.data
47 SELECT * FROM hash_txt_heap
48 WHERE hash_txt_heap.random = '1351610853'::text;
56 -- grep 111111112222222233333333 hash.data
58 SELECT * FROM hash_txt_heap
59 WHERE hash_txt_heap.random = '111111112222222233333333'::text;
66 -- grep 444705537 hash.data
68 SELECT * FROM hash_f8_heap
69 WHERE hash_f8_heap.random = '444705537'::float8;
77 -- grep 88888888 hash.data
79 SELECT * FROM hash_f8_heap
80 WHERE hash_f8_heap.random = '88888888'::float8;
87 -- grep '^90[^0-9]' hashovfl.data
89 -- SELECT count(*) AS i988 FROM hash_ovfl_heap
93 -- grep '^1000[^0-9]' hashovfl.data
95 -- SELECT count(*) AS i0 FROM hash_ovfl_heap
102 WHERE hash_i4_heap.seqno = 1492;
103 SELECT h.seqno AS i1492, h.random AS i1
113 WHERE hash_i4_heap.random = 1492795354;
114 SELECT h.seqno AS i20000
116 WHERE h.random = 1492795354;
122 UPDATE hash_name_heap
123 SET random = '0123456789abcdef'::name
124 WHERE hash_name_heap.seqno = 6543;
125 SELECT h.seqno AS i6543, h.random AS c0_to_f
126 FROM hash_name_heap h
127 WHERE h.random = '0123456789abcdef'::name;
129 -------+------------------
130 6543 | 0123456789abcdef
133 UPDATE hash_name_heap
135 WHERE hash_name_heap.random = '76652222'::name;
137 -- this is the row we just replaced; index scan should return zero rows
139 SELECT h.seqno AS emptyset
140 FROM hash_name_heap h
141 WHERE h.random = '76652222'::name;
147 SET random = '0123456789abcdefghijklmnop'::text
148 WHERE hash_txt_heap.seqno = 4002;
149 SELECT h.seqno AS i4002, h.random AS c0_to_p
151 WHERE h.random = '0123456789abcdefghijklmnop'::text;
153 -------+----------------------------
154 4002 | 0123456789abcdefghijklmnop
159 WHERE hash_txt_heap.random = '959363399'::text;
160 SELECT h.seqno AS t20000
162 WHERE h.random = '959363399'::text;
169 SET random = '-1234.1234'::float8
170 WHERE hash_f8_heap.seqno = 8906;
171 SELECT h.seqno AS i8096, h.random AS f1234_1234
173 WHERE h.random = '-1234.1234'::float8;
181 WHERE hash_f8_heap.random = '488912369'::float8;
182 SELECT h.seqno AS f20000
184 WHERE h.random = '488912369'::float8;
190 -- UPDATE hash_ovfl_heap
193 -- this vacuums the index as well
194 -- VACUUM hash_ovfl_heap;
195 -- SELECT count(*) AS i0 FROM hash_ovfl_heap
197 -- SELECT count(*) AS i988 FROM hash_ovfl_heap
200 -- Cause some overflow insert and splits.
202 CREATE TABLE hash_split_heap (keycol INT);
203 INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 500) a;
204 CREATE INDEX hash_split_index on hash_split_heap USING HASH (keycol);
205 INSERT INTO hash_split_heap SELECT 1 FROM generate_series(1, 5000) a;
206 -- Let's do a backward scan.
208 SET enable_seqscan = OFF;
209 SET enable_bitmapscan = OFF;
210 DECLARE c CURSOR FOR SELECT * from hash_split_heap WHERE keycol = 1;
211 MOVE FORWARD ALL FROM c;
212 MOVE BACKWARD 10000 FROM c;
213 MOVE BACKWARD ALL FROM c;
216 -- DELETE, INSERT, VACUUM.
217 DELETE FROM hash_split_heap WHERE keycol = 1;
218 INSERT INTO hash_split_heap SELECT a/2 FROM generate_series(1, 25000) a;
219 VACUUM hash_split_heap;
220 -- Rebuild the index using a different fillfactor
221 ALTER INDEX hash_split_index SET (fillfactor = 10);
222 REINDEX INDEX hash_split_index;
224 DROP TABLE hash_split_heap;
225 -- Index on temp table.
226 CREATE TEMP TABLE hash_temp_heap (x int, y int);
227 INSERT INTO hash_temp_heap VALUES (1,1);
228 CREATE INDEX hash_idx ON hash_temp_heap USING hash (x);
229 DROP TABLE hash_temp_heap CASCADE;
231 CREATE TABLE hash_heap_float4 (x float4, y int);
232 INSERT INTO hash_heap_float4 VALUES (1.1,1);
233 CREATE INDEX hash_idx ON hash_heap_float4 USING hash (x);
234 DROP TABLE hash_heap_float4 CASCADE;
235 -- Test out-of-range fillfactor values
236 CREATE INDEX hash_f8_index2 ON hash_f8_heap USING hash (random float8_ops)
238 ERROR: value 9 out of bounds for option "fillfactor"
239 DETAIL: Valid values are between "10" and "100".
240 CREATE INDEX hash_f8_index2 ON hash_f8_heap USING hash (random float8_ops)
241 WITH (fillfactor=101);
242 ERROR: value 101 out of bounds for option "fillfactor"
243 DETAIL: Valid values are between "10" and "100".