ten | cidr | inet
-----+--------------------+------------------
| 192.168.1.0/24 | 192.168.1.226/24
- | 192.168.1.0/26 | 192.168.1.226
- | 192.168.1.0/24 | 192.168.1.0/24
- | 192.168.1.0/24 | 192.168.1.0/25
+ | 192.168.1.0/26 | 192.168.1.226
+ | 192.168.1.0/24 | 192.168.1.0/24
+ | 192.168.1.0/24 | 192.168.1.0/25
| 192.168.1.0/24 | 192.168.1.255/24
| 192.168.1.0/24 | 192.168.1.255/25
- | 10.0.0.0/8 | 10.1.2.3/8
- | 10.0.0.0/32 | 10.1.2.3/8
- | 10.1.2.3/32 | 10.1.2.3
- | 10.1.2.0/24 | 10.1.2.3/24
- | 10.1.0.0/16 | 10.1.2.3/16
- | 10.0.0.0/8 | 10.1.2.3/8
- | 10.0.0.0/8 | 11.1.2.3/8
- | 10.0.0.0/8 | 9.1.2.3/8
- | 10:23::f1/128 | 10:23::f1/64
- | 10:23::8000/113 | 10:23::ffff
- | ::ffff:1.2.3.4/128 | ::4.3.2.1/24
+ | 10.0.0.0/8 | 10.1.2.3/8
+ | 10.0.0.0/32 | 10.1.2.3/8
+ | 10.1.2.3/32 | 10.1.2.3
+ | 10.1.2.0/24 | 10.1.2.3/24
+ | 10.1.0.0/16 | 10.1.2.3/16
+ | 10.0.0.0/8 | 10.1.2.3/8
+ | 10.0.0.0/8 | 11.1.2.3/8
+ | 10.0.0.0/8 | 9.1.2.3/8
+ | 10:23::f1/128 | 10:23::f1/64
+ | 10:23::8000/113 | 10:23::ffff
+ | ::ffff:1.2.3.4/128 | ::4.3.2.1/24
(17 rows)
-- now test some support functions
i AS inet, broadcast(i) FROM INET_TBL;
ten | cidr | broadcast | inet | broadcast
-----+--------------------+------------------+------------------+---------------------------------------
- | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.226/24 | 192.168.1.255/24
- | 192.168.1.0/26 | 192.168.1.63/26 | 192.168.1.226 | 192.168.1.226
- | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24
- | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/25 | 192.168.1.127/25
- | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/24 | 192.168.1.255/24
- | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/25 | 192.168.1.255/25
- | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8
- | 10.0.0.0/32 | 10.0.0.0 | 10.1.2.3/8 | 10.255.255.255/8
- | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3 | 10.1.2.3
- | 10.1.2.0/24 | 10.1.2.255/24 | 10.1.2.3/24 | 10.1.2.255/24
- | 10.1.0.0/16 | 10.1.255.255/16 | 10.1.2.3/16 | 10.1.255.255/16
- | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8
- | 10.0.0.0/8 | 10.255.255.255/8 | 11.1.2.3/8 | 11.255.255.255/8
- | 10.0.0.0/8 | 10.255.255.255/8 | 9.1.2.3/8 | 9.255.255.255/8
- | 10:23::f1/128 | 10:23::f1 | 10:23::f1/64 | 10:23::ffff:ffff:ffff:ffff/64
- | 10:23::8000/113 | 10:23::ffff/113 | 10:23::ffff | 10:23::ffff
+ | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.226/24 | 192.168.1.255/24
+ | 192.168.1.0/26 | 192.168.1.63/26 | 192.168.1.226 | 192.168.1.226
+ | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24
+ | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/25 | 192.168.1.127/25
+ | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/24 | 192.168.1.255/24
+ | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.255/25 | 192.168.1.255/25
+ | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8
+ | 10.0.0.0/32 | 10.0.0.0 | 10.1.2.3/8 | 10.255.255.255/8
+ | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3 | 10.1.2.3
+ | 10.1.2.0/24 | 10.1.2.255/24 | 10.1.2.3/24 | 10.1.2.255/24
+ | 10.1.0.0/16 | 10.1.255.255/16 | 10.1.2.3/16 | 10.1.255.255/16
+ | 10.0.0.0/8 | 10.255.255.255/8 | 10.1.2.3/8 | 10.255.255.255/8
+ | 10.0.0.0/8 | 10.255.255.255/8 | 11.1.2.3/8 | 11.255.255.255/8
+ | 10.0.0.0/8 | 10.255.255.255/8 | 9.1.2.3/8 | 9.255.255.255/8
+ | 10:23::f1/128 | 10:23::f1 | 10:23::f1/64 | 10:23::ffff:ffff:ffff:ffff/64
+ | 10:23::8000/113 | 10:23::ffff/113 | 10:23::ffff | 10:23::ffff
| ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4 | ::4.3.2.1/24 | 0:ff:ffff:ffff:ffff:ffff:ffff:ffff/24
(17 rows)
i AS inet, network(i) AS "network(inet)" FROM INET_TBL;
ten | cidr | network(cidr) | inet | network(inet)
-----+--------------------+--------------------+------------------+------------------
- | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.226/24 | 192.168.1.0/24
+ | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.226/24 | 192.168.1.0/24
| 192.168.1.0/26 | 192.168.1.0/26 | 192.168.1.226 | 192.168.1.226/32
- | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24
- | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/25 | 192.168.1.0/25
- | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24
+ | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24
+ | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/25 | 192.168.1.0/25
+ | 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/24 | 192.168.1.0/24
| 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.255/25 | 192.168.1.128/25
- | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8
- | 10.0.0.0/32 | 10.0.0.0/32 | 10.1.2.3/8 | 10.0.0.0/8
- | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3/32
- | 10.1.2.0/24 | 10.1.2.0/24 | 10.1.2.3/24 | 10.1.2.0/24
- | 10.1.0.0/16 | 10.1.0.0/16 | 10.1.2.3/16 | 10.1.0.0/16
- | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8
- | 10.0.0.0/8 | 10.0.0.0/8 | 11.1.2.3/8 | 11.0.0.0/8
- | 10.0.0.0/8 | 10.0.0.0/8 | 9.1.2.3/8 | 9.0.0.0/8
- | 10:23::f1/128 | 10:23::f1/128 | 10:23::f1/64 | 10:23::/64
- | 10:23::8000/113 | 10:23::8000/113 | 10:23::ffff | 10:23::ffff/128
- | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128 | ::4.3.2.1/24 | ::/24
+ | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8
+ | 10.0.0.0/32 | 10.0.0.0/32 | 10.1.2.3/8 | 10.0.0.0/8
+ | 10.1.2.3/32 | 10.1.2.3/32 | 10.1.2.3 | 10.1.2.3/32
+ | 10.1.2.0/24 | 10.1.2.0/24 | 10.1.2.3/24 | 10.1.2.0/24
+ | 10.1.0.0/16 | 10.1.0.0/16 | 10.1.2.3/16 | 10.1.0.0/16
+ | 10.0.0.0/8 | 10.0.0.0/8 | 10.1.2.3/8 | 10.0.0.0/8
+ | 10.0.0.0/8 | 10.0.0.0/8 | 11.1.2.3/8 | 11.0.0.0/8
+ | 10.0.0.0/8 | 10.0.0.0/8 | 9.1.2.3/8 | 9.0.0.0/8
+ | 10:23::f1/128 | 10:23::f1/128 | 10:23::f1/64 | 10:23::/64
+ | 10:23::8000/113 | 10:23::8000/113 | 10:23::ffff | 10:23::ffff/128
+ | ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128 | ::4.3.2.1/24 | ::/24
(17 rows)
SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
six | cidr | inet
-----+----------------+----------------
| 192.168.1.0/24 | 192.168.1.0/24
- | 10.1.2.3/32 | 10.1.2.3
+ | 10.1.2.3/32 | 10.1.2.3
(2 rows)
SELECT '' AS ten, i, c,
FROM INET_TBL;
ten | i | c | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe
-----+------------------+--------------------+----+----+----+----+----+----+----+-----+-----+-----
- | 192.168.1.226/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t
- | 192.168.1.226 | 192.168.1.0/26 | f | f | f | t | t | t | f | f | f | f
- | 192.168.1.0/24 | 192.168.1.0/24 | f | t | t | t | f | f | f | t | f | t
- | 192.168.1.0/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f
- | 192.168.1.255/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t
- | 192.168.1.255/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f
- | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t
- | 10.1.2.3/8 | 10.0.0.0/32 | t | t | f | f | f | t | f | f | t | t
- | 10.1.2.3 | 10.1.2.3/32 | f | t | t | t | f | f | f | t | f | t
- | 10.1.2.3/24 | 10.1.2.0/24 | f | f | f | t | t | t | f | t | f | t
- | 10.1.2.3/16 | 10.1.0.0/16 | f | f | f | t | t | t | f | t | f | t
- | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t
- | 11.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | f | f | f
- | 9.1.2.3/8 | 10.0.0.0/8 | t | t | f | f | f | t | f | f | f | f
- | 10:23::f1/64 | 10:23::f1/128 | t | t | f | f | f | t | f | f | t | t
- | 10:23::ffff | 10:23::8000/113 | f | f | f | t | t | t | t | t | f | f
- | ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | t | t | f | f | f | t | f | f | t | t
+ | 192.168.1.226/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t
+ | 192.168.1.226 | 192.168.1.0/26 | f | f | f | t | t | t | f | f | f | f
+ | 192.168.1.0/24 | 192.168.1.0/24 | f | t | t | t | f | f | f | t | f | t
+ | 192.168.1.0/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f
+ | 192.168.1.255/24 | 192.168.1.0/24 | f | f | f | t | t | t | f | t | f | t
+ | 192.168.1.255/25 | 192.168.1.0/24 | f | f | f | t | t | t | t | t | f | f
+ | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t
+ | 10.1.2.3/8 | 10.0.0.0/32 | t | t | f | f | f | t | f | f | t | t
+ | 10.1.2.3 | 10.1.2.3/32 | f | t | t | t | f | f | f | t | f | t
+ | 10.1.2.3/24 | 10.1.2.0/24 | f | f | f | t | t | t | f | t | f | t
+ | 10.1.2.3/16 | 10.1.0.0/16 | f | f | f | t | t | t | f | t | f | t
+ | 10.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | t | f | t
+ | 11.1.2.3/8 | 10.0.0.0/8 | f | f | f | t | t | t | f | f | f | f
+ | 9.1.2.3/8 | 10.0.0.0/8 | t | t | f | f | f | t | f | f | f | f
+ | 10:23::f1/64 | 10:23::f1/128 | t | t | f | f | f | t | f | f | t | t
+ | 10:23::ffff | 10:23::8000/113 | f | f | f | t | t | t | t | t | f | f
+ | ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | t | t | f | f | f | t | f | f | t | t
(17 rows)
-- check the conversion to/from text and set_netmask
-----+------------------
| 192.168.1.226/24
| 192.168.1.226/24
- | 192.168.1.0/24
- | 192.168.1.0/24
+ | 192.168.1.0/24
+ | 192.168.1.0/24
| 192.168.1.255/24
| 192.168.1.255/24
- | 10.1.2.3/24
- | 10.1.2.3/24
- | 10.1.2.3/24
- | 10.1.2.3/24
- | 10.1.2.3/24
- | 10.1.2.3/24
- | 11.1.2.3/24
- | 9.1.2.3/24
- | 10:23::f1/24
- | 10:23::ffff/24
- | ::4.3.2.1/24
+ | 10.1.2.3/24
+ | 10.1.2.3/24
+ | 10.1.2.3/24
+ | 10.1.2.3/24
+ | 10.1.2.3/24
+ | 10.1.2.3/24
+ | 11.1.2.3/24
+ | 9.1.2.3/24
+ | 10:23::f1/24
+ | 10:23::ffff/24
+ | ::4.3.2.1/24
(17 rows)
-- check that index works correctly
SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr;
c | i
----------------+------------------
- 192.168.1.0/24 | 192.168.1.0/25
+ 192.168.1.0/24 | 192.168.1.0/25
192.168.1.0/24 | 192.168.1.255/25
- 192.168.1.0/26 | 192.168.1.226
+ 192.168.1.0/26 | 192.168.1.226
(3 rows)
SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
c | i
----------------+------------------
- 192.168.1.0/24 | 192.168.1.0/24
+ 192.168.1.0/24 | 192.168.1.0/24
192.168.1.0/24 | 192.168.1.226/24
192.168.1.0/24 | 192.168.1.255/24
- 192.168.1.0/24 | 192.168.1.0/25
+ 192.168.1.0/24 | 192.168.1.0/25
192.168.1.0/24 | 192.168.1.255/25
- 192.168.1.0/26 | 192.168.1.226
+ 192.168.1.0/26 | 192.168.1.226
(6 rows)
SET enable_seqscan TO on;
SELECT i, ~i AS "~i" FROM inet_tbl;
i | ~i
------------------+--------------------------------------------
- 192.168.1.226/24 | 63.87.254.29/24
- 192.168.1.226 | 63.87.254.29
- 192.168.1.0/24 | 63.87.254.255/24
- 192.168.1.0/25 | 63.87.254.255/25
- 192.168.1.255/24 | 63.87.254.0/24
- 192.168.1.255/25 | 63.87.254.0/25
- 10.1.2.3/8 | 245.254.253.252/8
- 10.1.2.3/8 | 245.254.253.252/8
- 10.1.2.3 | 245.254.253.252
- 10.1.2.3/24 | 245.254.253.252/24
- 10.1.2.3/16 | 245.254.253.252/16
- 10.1.2.3/8 | 245.254.253.252/8
- 11.1.2.3/8 | 244.254.253.252/8
- 9.1.2.3/8 | 246.254.253.252/8
+ 192.168.1.226/24 | 63.87.254.29/24
+ 192.168.1.226 | 63.87.254.29
+ 192.168.1.0/24 | 63.87.254.255/24
+ 192.168.1.0/25 | 63.87.254.255/25
+ 192.168.1.255/24 | 63.87.254.0/24
+ 192.168.1.255/25 | 63.87.254.0/25
+ 10.1.2.3/8 | 245.254.253.252/8
+ 10.1.2.3/8 | 245.254.253.252/8
+ 10.1.2.3 | 245.254.253.252
+ 10.1.2.3/24 | 245.254.253.252/24
+ 10.1.2.3/16 | 245.254.253.252/16
+ 10.1.2.3/8 | 245.254.253.252/8
+ 11.1.2.3/8 | 244.254.253.252/8
+ 9.1.2.3/8 | 246.254.253.252/8
10:23::f1/64 | ffef:ffdc:ffff:ffff:ffff:ffff:ffff:ff0e/64
- 10:23::ffff | ffef:ffdc:ffff:ffff:ffff:ffff:ffff:0
+ 10:23::ffff | ffef:ffdc:ffff:ffff:ffff:ffff:ffff:0
::4.3.2.1/24 | ffff:ffff:ffff:ffff:ffff:ffff:fbfc:fdfe/24
(17 rows)
i | c | and
------------------+--------------------+----------------
192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.0/24
- 192.168.1.226 | 192.168.1.0/26 | 192.168.1.0
+ 192.168.1.226 | 192.168.1.0/26 | 192.168.1.0
192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24
192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25
192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.0/24
192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.0/25
- 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
- 10.1.2.3/8 | 10.0.0.0/32 | 10.0.0.0
- 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
- 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.0/24
- 10.1.2.3/16 | 10.1.0.0/16 | 10.1.0.0/16
- 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
- 11.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
- 9.1.2.3/8 | 10.0.0.0/8 | 8.0.0.0/8
- 10:23::f1/64 | 10:23::f1/128 | 10:23::f1
- 10:23::ffff | 10:23::8000/113 | 10:23::8000
- ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::0.2.2.0
+ 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
+ 10.1.2.3/8 | 10.0.0.0/32 | 10.0.0.0
+ 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
+ 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.0/24
+ 10.1.2.3/16 | 10.1.0.0/16 | 10.1.0.0/16
+ 10.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
+ 11.1.2.3/8 | 10.0.0.0/8 | 10.0.0.0/8
+ 9.1.2.3/8 | 10.0.0.0/8 | 8.0.0.0/8
+ 10:23::f1/64 | 10:23::f1/128 | 10:23::f1
+ 10:23::ffff | 10:23::8000/113 | 10:23::8000
+ ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::0.2.2.0
(17 rows)
SELECT i, c, i | c AS "or" FROM inet_tbl;
i | c | or
------------------+--------------------+------------------
192.168.1.226/24 | 192.168.1.0/24 | 192.168.1.226/24
- 192.168.1.226 | 192.168.1.0/26 | 192.168.1.226
- 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24
- 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25
+ 192.168.1.226 | 192.168.1.0/26 | 192.168.1.226
+ 192.168.1.0/24 | 192.168.1.0/24 | 192.168.1.0/24
+ 192.168.1.0/25 | 192.168.1.0/24 | 192.168.1.0/25
192.168.1.255/24 | 192.168.1.0/24 | 192.168.1.255/24
192.168.1.255/25 | 192.168.1.0/24 | 192.168.1.255/25
- 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8
- 10.1.2.3/8 | 10.0.0.0/32 | 10.1.2.3
- 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
- 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.3/24
- 10.1.2.3/16 | 10.1.0.0/16 | 10.1.2.3/16
- 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8
- 11.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8
- 9.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8
- 10:23::f1/64 | 10:23::f1/128 | 10:23::f1
- 10:23::ffff | 10:23::8000/113 | 10:23::ffff
- ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::ffff:5.3.3.5
+ 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8
+ 10.1.2.3/8 | 10.0.0.0/32 | 10.1.2.3
+ 10.1.2.3 | 10.1.2.3/32 | 10.1.2.3
+ 10.1.2.3/24 | 10.1.2.0/24 | 10.1.2.3/24
+ 10.1.2.3/16 | 10.1.0.0/16 | 10.1.2.3/16
+ 10.1.2.3/8 | 10.0.0.0/8 | 10.1.2.3/8
+ 11.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8
+ 9.1.2.3/8 | 10.0.0.0/8 | 11.1.2.3/8
+ 10:23::f1/64 | 10:23::f1/128 | 10:23::f1
+ 10:23::ffff | 10:23::8000/113 | 10:23::ffff
+ ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | ::ffff:5.3.3.5
(17 rows)
SELECT i, i + 500 AS "i+500" FROM inet_tbl;
i | i+500
------------------+------------------
192.168.1.226/24 | 192.168.3.214/24
- 192.168.1.226 | 192.168.3.214
+ 192.168.1.226 | 192.168.3.214
192.168.1.0/24 | 192.168.2.244/24
192.168.1.0/25 | 192.168.2.244/25
192.168.1.255/24 | 192.168.3.243/24
192.168.1.255/25 | 192.168.3.243/25
- 10.1.2.3/8 | 10.1.3.247/8
- 10.1.2.3/8 | 10.1.3.247/8
- 10.1.2.3 | 10.1.3.247
- 10.1.2.3/24 | 10.1.3.247/24
- 10.1.2.3/16 | 10.1.3.247/16
- 10.1.2.3/8 | 10.1.3.247/8
- 11.1.2.3/8 | 11.1.3.247/8
- 9.1.2.3/8 | 9.1.3.247/8
- 10:23::f1/64 | 10:23::2e5/64
- 10:23::ffff | 10:23::1:1f3
- ::4.3.2.1/24 | ::4.3.3.245/24
+ 10.1.2.3/8 | 10.1.3.247/8
+ 10.1.2.3/8 | 10.1.3.247/8
+ 10.1.2.3 | 10.1.3.247
+ 10.1.2.3/24 | 10.1.3.247/24
+ 10.1.2.3/16 | 10.1.3.247/16
+ 10.1.2.3/8 | 10.1.3.247/8
+ 11.1.2.3/8 | 11.1.3.247/8
+ 9.1.2.3/8 | 9.1.3.247/8
+ 10:23::f1/64 | 10:23::2e5/64
+ 10:23::ffff | 10:23::1:1f3
+ ::4.3.2.1/24 | ::4.3.3.245/24
(17 rows)
SELECT i, i - 500 AS "i-500" FROM inet_tbl;
i | i-500
------------------+----------------------------------------
- 192.168.1.226/24 | 192.167.255.238/24
- 192.168.1.226 | 192.167.255.238
- 192.168.1.0/24 | 192.167.255.12/24
- 192.168.1.0/25 | 192.167.255.12/25
- 192.168.1.255/24 | 192.168.0.11/24
- 192.168.1.255/25 | 192.168.0.11/25
- 10.1.2.3/8 | 10.1.0.15/8
- 10.1.2.3/8 | 10.1.0.15/8
- 10.1.2.3 | 10.1.0.15
- 10.1.2.3/24 | 10.1.0.15/24
- 10.1.2.3/16 | 10.1.0.15/16
- 10.1.2.3/8 | 10.1.0.15/8
- 11.1.2.3/8 | 11.1.0.15/8
- 9.1.2.3/8 | 9.1.0.15/8
+ 192.168.1.226/24 | 192.167.255.238/24
+ 192.168.1.226 | 192.167.255.238
+ 192.168.1.0/24 | 192.167.255.12/24
+ 192.168.1.0/25 | 192.167.255.12/25
+ 192.168.1.255/24 | 192.168.0.11/24
+ 192.168.1.255/25 | 192.168.0.11/25
+ 10.1.2.3/8 | 10.1.0.15/8
+ 10.1.2.3/8 | 10.1.0.15/8
+ 10.1.2.3 | 10.1.0.15
+ 10.1.2.3/24 | 10.1.0.15/24
+ 10.1.2.3/16 | 10.1.0.15/16
+ 10.1.2.3/8 | 10.1.0.15/8
+ 11.1.2.3/8 | 11.1.0.15/8
+ 9.1.2.3/8 | 9.1.0.15/8
10:23::f1/64 | 10:22:ffff:ffff:ffff:ffff:ffff:fefd/64
- 10:23::ffff | 10:23::fe0b
- ::4.3.2.1/24 | ::4.3.0.13/24
+ 10:23::ffff | 10:23::fe0b
+ ::4.3.2.1/24 | ::4.3.0.13/24
(17 rows)
SELECT i, c, i - c AS "minus" FROM inet_tbl;
SELECT ('127::1'::inet + 257) - 257;
?column?
----------
- 127::1
+ 127::1
(1 row)
SELECT '127.0.0.2'::inet - ('127.0.0.2'::inet + 500);