1-- macaddr check
2CREATE TABLE macaddr8tmp (a macaddr8);
3\copy macaddr8tmp from 'data/macaddr.data'
4SET enable_seqscan=on;
5SELECT count(*) FROM macaddr8tmp WHERE a <  '22:00:5c:e5:9b:0d';
6 count
7-------
8    56
9(1 row)
10
11SELECT count(*) FROM macaddr8tmp WHERE a <= '22:00:5c:e5:9b:0d';
12 count
13-------
14    60
15(1 row)
16
17SELECT count(*) FROM macaddr8tmp WHERE a  = '22:00:5c:e5:9b:0d';
18 count
19-------
20     4
21(1 row)
22
23SELECT count(*) FROM macaddr8tmp WHERE a >= '22:00:5c:e5:9b:0d';
24 count
25-------
26   544
27(1 row)
28
29SELECT count(*) FROM macaddr8tmp WHERE a >  '22:00:5c:e5:9b:0d';
30 count
31-------
32   540
33(1 row)
34
35CREATE INDEX macaddr8idx ON macaddr8tmp USING gist ( a );
36SET enable_seqscan=off;
37SELECT count(*) FROM macaddr8tmp WHERE a <  '22:00:5c:e5:9b:0d'::macaddr8;
38 count
39-------
40    56
41(1 row)
42
43SELECT count(*) FROM macaddr8tmp WHERE a <= '22:00:5c:e5:9b:0d'::macaddr8;
44 count
45-------
46    60
47(1 row)
48
49SELECT count(*) FROM macaddr8tmp WHERE a  = '22:00:5c:e5:9b:0d'::macaddr8;
50 count
51-------
52     4
53(1 row)
54
55SELECT count(*) FROM macaddr8tmp WHERE a >= '22:00:5c:e5:9b:0d'::macaddr8;
56 count
57-------
58   544
59(1 row)
60
61SELECT count(*) FROM macaddr8tmp WHERE a >  '22:00:5c:e5:9b:0d'::macaddr8;
62 count
63-------
64   540
65(1 row)
66
67-- Test index-only scans
68SET enable_bitmapscan=off;
69EXPLAIN (COSTS OFF)
70SELECT * FROM macaddr8tmp WHERE a < '02:03:04:05:06:07'::macaddr8;
71                       QUERY PLAN
72---------------------------------------------------------
73 Index Only Scan using macaddr8idx on macaddr8tmp
74   Index Cond: (a < '02:03:04:ff:fe:05:06:07'::macaddr8)
75(2 rows)
76
77SELECT * FROM macaddr8tmp WHERE a < '02:03:04:05:06:07'::macaddr8;
78            a
79-------------------------
80 01:02:37:ff:fe:05:4f:36
81 01:02:37:ff:fe:05:4f:36
82 01:02:37:ff:fe:05:4f:36
83 01:02:37:ff:fe:05:4f:36
84 01:43:b5:ff:fe:79:eb:0f
85 01:43:b5:ff:fe:79:eb:0f
86 01:43:b5:ff:fe:79:eb:0f
87 01:43:b5:ff:fe:79:eb:0f
88(8 rows)
89
90