@@ -9,84 +9,98 @@ QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32');
99QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24');
1010QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16');
1111QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
12- QUERY: SELECT '' as eight, c as cidr, i as inet FROM INET_TBL;
13- eight|cidr |inet
14- -----+------------+----------------
15- |192.168.1/24|192.168.1.226/24
16- |192.168.1/24|192.168.1.226
17- |10/8 |10.1.2.3/8
18- |10.0.0.0/32 |10.1.2.3/8
19- |10.1.2.3/32 |10.1.2.3
20- |10.1.2/24 |10.1.2.3/24
21- |10.1/16 |10.1.2.3/16
22- |10/8 |10.1.2.3/8
23- (8 rows)
12+ QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8');
13+ QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8');
14+ QUERY: SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
15+ ten|cidr |inet
16+ ---+------------+----------------
17+ |192.168.1/24|192.168.1.226/24
18+ |192.168.1/24|192.168.1.226
19+ |10/8 |10.1.2.3/8
20+ |10.0.0.0/32 |10.1.2.3/8
21+ |10.1.2.3/32 |10.1.2.3
22+ |10.1.2/24 |10.1.2.3/24
23+ |10.1/16 |10.1.2.3/16
24+ |10/8 |10.1.2.3/8
25+ |10/8 |11.1.2.3/8
26+ |10/8 |9.1.2.3/8
27+ (10 rows)
2428
25- QUERY: SELECT '' as eight, i as inet, host(i) FROM INET_TBL;
26- eight|inet | host
27- -----+----------------+-------------
28- |192.168.1.226/24|192.168.1.226
29- |192.168.1.226 |192.168.1.226
30- |10.1.2.3/8 | 10.1.2.3
31- |10.1.2.3/8 | 10.1.2.3
32- |10.1.2.3 | 10.1.2.3
33- |10.1.2.3/24 | 10.1.2.3
34- |10.1.2.3/16 | 10.1.2.3
35- |10.1.2.3/8 | 10.1.2.3
36- (8 rows)
29+ QUERY: SELECT '' AS ten, i AS inet, host(i) FROM INET_TBL;
30+ ten|inet | host
31+ ---+----------------+-------------
32+ |192.168.1.226/24|192.168.1.226
33+ |192.168.1.226 |192.168.1.226
34+ |10.1.2.3/8 | 10.1.2.3
35+ |10.1.2.3/8 | 10.1.2.3
36+ |10.1.2.3 | 10.1.2.3
37+ |10.1.2.3/24 | 10.1.2.3
38+ |10.1.2.3/16 | 10.1.2.3
39+ |10.1.2.3/8 | 10.1.2.3
40+ |11.1.2.3/8 | 11.1.2.3
41+ |9.1.2.3/8 | 9.1.2.3
42+ (10 rows)
3743
38- QUERY: SELECT '' as eight, c as cidr, broadcast(c),
39- i as inet, broadcast(i) FROM INET_TBL;
40- eight|cidr | broadcast|inet | broadcast
41- -----+------------+---------------+----------------+---------------
42- |192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255
43- |192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255
44- |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
45- |10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255
46- |10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255
47- |10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255
48- |10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255
49- |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
50- (8 rows)
44+ QUERY: SELECT '' AS ten, c AS cidr, broadcast(c),
45+ i AS inet, broadcast(i) FROM INET_TBL;
46+ ten|cidr | broadcast|inet | broadcast
47+ ---+------------+---------------+----------------+---------------
48+ |192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255
49+ |192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255
50+ |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
51+ |10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255
52+ |10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255
53+ |10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255
54+ |10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255
55+ |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
56+ |10/8 | 10.255.255.255|11.1.2.3/8 | 11.255.255.255
57+ |10/8 | 10.255.255.255|9.1.2.3/8 | 9.255.255.255
58+ (10 rows)
5159
52- QUERY: SELECT '' as eight, c as cidr, network(c) as "network(cidr)",
53- i as inet, network(i) as "network(inet)" FROM INET_TBL;
54- eight|cidr |network(cidr)|inet |network(inet)
55- -----+------------+-------------+----------------+-------------
56- |192.168.1/24| 0.1.168.192|192.168.1.226/24| 0.1.168.192
57- |192.168.1/24| 0.1.168.192|192.168.1.226 |226.1.168.192
58- |10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
59- |10.0.0.0/32 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
60- |10.1.2.3/32 | 3.2.1.10|10.1.2.3 | 3.2.1.10
61- |10.1.2/24 | 0.2.1.10|10.1.2.3/24 | 0.2.1.10
62- |10.1/16 | 0.0.1.10|10.1.2.3/16 | 0.0.1.10
63- |10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
64- (8 rows)
60+ QUERY: SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
61+ i AS inet, network(i) AS "network(inet)" FROM INET_TBL;
62+ ten|cidr |network(cidr)|inet |network(inet)
63+ ---+------------+-------------+----------------+----------------
64+ |192.168.1/24|192.168.1/24 |192.168.1.226/24|192.168.1/24
65+ |192.168.1/24|192.168.1/24 |192.168.1.226 |192.168.1.226/32
66+ |10/8 |10/8 |10.1.2.3/8 |10/8
67+ |10.0.0.0/32 |10.0.0.0/32 |10.1.2.3/8 |10/8
68+ |10.1.2.3/32 |10.1.2.3/32 |10.1.2.3 |10.1.2.3/32
69+ |10.1.2/24 |10.1.2/24 |10.1.2.3/24 |10.1.2/24
70+ |10.1/16 |10.1/16 |10.1.2.3/16 |10.1/16
71+ |10/8 |10/8 |10.1.2.3/8 |10/8
72+ |10/8 |10/8 |11.1.2.3/8 |11/8
73+ |10/8 |10/8 |9.1.2.3/8 |9/8
74+ (10 rows)
6575
66- QUERY: SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)",
67- i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL;
68- eight|cidr |masklen(cidr)|inet |masklen(inet)
69- -----+------------+-------------+----------------+-------------
70- |192.168.1/24| 24|192.168.1.226/24| 24
71- |192.168.1/24| 24|192.168.1.226 | 32
72- |10/8 | 8|10.1.2.3/8 | 8
73- |10.0.0.0/32 | 32|10.1.2.3/8 | 8
74- |10.1.2.3/32 | 32|10.1.2.3 | 32
75- |10.1.2/24 | 24|10.1.2.3/24 | 24
76- |10.1/16 | 16|10.1.2.3/16 | 16
77- |10/8 | 8|10.1.2.3/8 | 8
78- (8 rows)
76+ QUERY: SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
77+ i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL;
78+ ten|cidr |masklen(cidr)|inet |masklen(inet)
79+ ---+------------+-------------+----------------+-------------
80+ |192.168.1/24| 24|192.168.1.226/24| 24
81+ |192.168.1/24| 24|192.168.1.226 | 32
82+ |10/8 | 8|10.1.2.3/8 | 8
83+ |10.0.0.0/32 | 32|10.1.2.3/8 | 8
84+ |10.1.2.3/32 | 32|10.1.2.3 | 32
85+ |10.1.2/24 | 24|10.1.2.3/24 | 24
86+ |10.1/16 | 16|10.1.2.3/16 | 16
87+ |10/8 | 8|10.1.2.3/8 | 8
88+ |10/8 | 8|11.1.2.3/8 | 8
89+ |10/8 | 8|9.1.2.3/8 | 8
90+ (10 rows)
7991
80- QUERY: SELECT ''as two , cas cidr, masklen(c)as "masklen(cidr)",
81- ias inet, masklen(i)as "masklen(inet)" FROM INET_TBL
92+ QUERY: SELECT ''AS four , cAS cidr, masklen(c)AS "masklen(cidr)",
93+ iAS inet, masklen(i)AS "masklen(inet)" FROM INET_TBL
8294 WHERE masklen(c) <= 8;
83- two|cidr|masklen(cidr)|inet |masklen(inet)
84- ---+----+-------------+----------+-------------
85- |10/8| 8|10.1.2.3/8| 8
86- |10/8| 8|10.1.2.3/8| 8
87- (2 rows)
95+ four|cidr|masklen(cidr)|inet |masklen(inet)
96+ ----+----+-------------+----------+-------------
97+ |10/8| 8|10.1.2.3/8| 8
98+ |10/8| 8|10.1.2.3/8| 8
99+ |10/8| 8|11.1.2.3/8| 8
100+ |10/8| 8|9.1.2.3/8 | 8
101+ (4 rows)
88102
89- QUERY: SELECT ''as six, cas cidr, ias inet FROM INET_TBL
103+ QUERY: SELECT ''AS six, cAS cidr, iAS inet FROM INET_TBL
90104 WHERE c = i;
91105six|cidr |inet
92106---+------------+----------------
@@ -98,3 +112,23 @@ six|cidr |inet
98112 |10/8 |10.1.2.3/8
99113(6 rows)
100114
115+ QUERY: SELECT '' AS ten, i, c,
116+ i < c AS lt, i <= c AS le, i = c AS eq,
117+ i >= c AS ge, i > c AS gt, i <> c AS ne,
118+ i << c AS sb, i <<= c AS sbe,
119+ i >> c AS sup, i >>= c AS spe
120+ FROM INET_TBL;
121+ ten|i |c |lt|le|eq|ge|gt|ne|sb|sbe|sup|spe
122+ ---+----------------+------------+--+--+--+--+--+--+--+---+---+---
123+ |192.168.1.226/24|192.168.1/24|f |t |t |t |f |f |f |t |f |t
124+ |192.168.1.226 |192.168.1/24|f |f |f |t |t |t |t |t |f |f
125+ |10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t
126+ |10.1.2.3/8 |10.0.0.0/32 |f |f |f |t |t |t |f |f |t |t
127+ |10.1.2.3 |10.1.2.3/32 |f |t |t |t |f |f |f |t |f |t
128+ |10.1.2.3/24 |10.1.2/24 |f |t |t |t |f |f |f |t |f |t
129+ |10.1.2.3/16 |10.1/16 |f |t |t |t |f |f |f |t |f |t
130+ |10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t
131+ |11.1.2.3/8 |10/8 |f |f |f |t |t |t |f |f |f |f
132+ |9.1.2.3/8 |10/8 |t |t |f |f |f |t |f |f |f |f
133+ (10 rows)
134+