1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add min and max aggregates for inet/cidr data types.

Haribabu Kommi, reviewed by Muhammad Asif Naeem
This commit is contained in:
Tom Lane
2014-08-28 22:37:58 -04:00
parent ec544a65c9
commit 6c40f8316e
8 changed files with 59 additions and 3 deletions

View File

@ -204,6 +204,18 @@ SELECT '' AS ten, i, c,
| ::4.3.2.1/24 | ::ffff:1.2.3.4/128 | t | t | f | f | f | t | f | f | t | t | t
(17 rows)
SELECT max(i) AS max, min(i) AS min FROM INET_TBL;
max | min
-------------+-----------
10:23::ffff | 9.1.2.3/8
(1 row)
SELECT max(c) AS max, min(c) AS min FROM INET_TBL;
max | min
-----------------+------------
10:23::8000/113 | 10.0.0.0/8
(1 row)
-- check the conversion to/from text and set_netmask
SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;
ten | set_masklen

View File

@ -56,6 +56,9 @@ SELECT '' AS ten, i, c,
i && c AS ovr
FROM INET_TBL;
SELECT max(i) AS max, min(i) AS min FROM INET_TBL;
SELECT max(c) AS max, min(c) AS min FROM INET_TBL;
-- check the conversion to/from text and set_netmask
SELECT '' AS ten, set_masklen(inet(text(i)), 24) FROM INET_TBL;