Add new inet/cidr regression test.
All regression tests pass on Linux/i686 with the current source tree.
This commit is contained in:
parent
0ebb238035
commit
695453738a
src/test/regress
100
src/test/regress/expected/inet.out
Normal file
100
src/test/regress/expected/inet.out
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
QUERY: DROP TABLE INET_TBL;
|
||||||
|
ERROR: Relation inet_tbl Does Not Exist!
|
||||||
|
QUERY: CREATE TABLE INET_TBL (c cidr, i inet);
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16');
|
||||||
|
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
|
||||||
|
QUERY: SELECT '' as eight, c as cidr, i as inet FROM INET_TBL;
|
||||||
|
eight|cidr |inet
|
||||||
|
-----+------------+----------------
|
||||||
|
|192.168.1/24|192.168.1.226/24
|
||||||
|
|192.168.1/24|192.168.1.226
|
||||||
|
|10/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/24 |10.1.2.3/24
|
||||||
|
|10.1/16 |10.1.2.3/16
|
||||||
|
|10/8 |10.1.2.3/8
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as eight, i as inet, host(i) FROM INET_TBL;
|
||||||
|
eight|inet | host
|
||||||
|
-----+----------------+-------------
|
||||||
|
|192.168.1.226/24|192.168.1.226
|
||||||
|
|192.168.1.226 |192.168.1.226
|
||||||
|
|10.1.2.3/8 | 10.1.2.3
|
||||||
|
|10.1.2.3/8 | 10.1.2.3
|
||||||
|
|10.1.2.3 | 10.1.2.3
|
||||||
|
|10.1.2.3/24 | 10.1.2.3
|
||||||
|
|10.1.2.3/16 | 10.1.2.3
|
||||||
|
|10.1.2.3/8 | 10.1.2.3
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as eight, c as cidr, broadcast(c),
|
||||||
|
i as inet, broadcast(i) FROM INET_TBL;
|
||||||
|
eight|cidr | broadcast|inet | broadcast
|
||||||
|
-----+------------+---------------+----------------+---------------
|
||||||
|
|192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255
|
||||||
|
|192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255
|
||||||
|
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
|
||||||
|
|10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255
|
||||||
|
|10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255
|
||||||
|
|10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255
|
||||||
|
|10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255
|
||||||
|
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as eight, c as cidr, network(c) as "network(cidr)",
|
||||||
|
i as inet, network(i) as "network(inet)" FROM INET_TBL;
|
||||||
|
eight|cidr |network(cidr)|inet |network(inet)
|
||||||
|
-----+------------+-------------+----------------+-------------
|
||||||
|
|192.168.1/24| 0.1.168.192|192.168.1.226/24| 0.1.168.192
|
||||||
|
|192.168.1/24| 0.1.168.192|192.168.1.226 |226.1.168.192
|
||||||
|
|10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
|
||||||
|
|10.0.0.0/32 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
|
||||||
|
|10.1.2.3/32 | 3.2.1.10|10.1.2.3 | 3.2.1.10
|
||||||
|
|10.1.2/24 | 0.2.1.10|10.1.2.3/24 | 0.2.1.10
|
||||||
|
|10.1/16 | 0.0.1.10|10.1.2.3/16 | 0.0.1.10
|
||||||
|
|10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)",
|
||||||
|
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL;
|
||||||
|
eight|cidr |masklen(cidr)|inet |masklen(inet)
|
||||||
|
-----+------------+-------------+----------------+-------------
|
||||||
|
|192.168.1/24| 24|192.168.1.226/24| 24
|
||||||
|
|192.168.1/24| 24|192.168.1.226 | 32
|
||||||
|
|10/8 | 8|10.1.2.3/8 | 8
|
||||||
|
|10.0.0.0/32 | 32|10.1.2.3/8 | 8
|
||||||
|
|10.1.2.3/32 | 32|10.1.2.3 | 32
|
||||||
|
|10.1.2/24 | 24|10.1.2.3/24 | 24
|
||||||
|
|10.1/16 | 16|10.1.2.3/16 | 16
|
||||||
|
|10/8 | 8|10.1.2.3/8 | 8
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)",
|
||||||
|
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL
|
||||||
|
WHERE masklen(c) <= 8;
|
||||||
|
two|cidr|masklen(cidr)|inet |masklen(inet)
|
||||||
|
---+----+-------------+----------+-------------
|
||||||
|
|10/8| 8|10.1.2.3/8| 8
|
||||||
|
|10/8| 8|10.1.2.3/8| 8
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
QUERY: SELECT '' as six, c as cidr, i as inet FROM INET_TBL
|
||||||
|
WHERE c = i;
|
||||||
|
six|cidr |inet
|
||||||
|
---+------------+----------------
|
||||||
|
|192.168.1/24|192.168.1.226/24
|
||||||
|
|10/8 |10.1.2.3/8
|
||||||
|
|10.1.2.3/32 |10.1.2.3
|
||||||
|
|10.1.2/24 |10.1.2.3/24
|
||||||
|
|10.1/16 |10.1.2.3/16
|
||||||
|
|10/8 |10.1.2.3/8
|
||||||
|
(6 rows)
|
||||||
|
|
@ -481,6 +481,7 @@ hash_txt_heap
|
|||||||
hobbies_r
|
hobbies_r
|
||||||
iexit
|
iexit
|
||||||
ihighway
|
ihighway
|
||||||
|
inet_tbl
|
||||||
insert_seq
|
insert_seq
|
||||||
insert_tbl
|
insert_tbl
|
||||||
int2_tbl
|
int2_tbl
|
||||||
@ -513,5 +514,5 @@ tinterval_tbl
|
|||||||
toyemp
|
toyemp
|
||||||
varchar_tbl
|
varchar_tbl
|
||||||
xacttest
|
xacttest
|
||||||
(71 rows)
|
(72 rows)
|
||||||
|
|
||||||
|
35
src/test/regress/sql/inet.sql
Normal file
35
src/test/regress/sql/inet.sql
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- INET regression tests
|
||||||
|
--
|
||||||
|
|
||||||
|
-- prepare the table...
|
||||||
|
|
||||||
|
DROP TABLE INET_TBL;
|
||||||
|
CREATE TABLE INET_TBL (c cidr, i inet);
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16');
|
||||||
|
INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
|
||||||
|
|
||||||
|
SELECT '' as eight, c as cidr, i as inet FROM INET_TBL;
|
||||||
|
|
||||||
|
-- now test some support functions
|
||||||
|
|
||||||
|
SELECT '' as eight, i as inet, host(i) FROM INET_TBL;
|
||||||
|
SELECT '' as eight, c as cidr, broadcast(c),
|
||||||
|
i as inet, broadcast(i) FROM INET_TBL;
|
||||||
|
SELECT '' as eight, c as cidr, network(c) as "network(cidr)",
|
||||||
|
i as inet, network(i) as "network(inet)" FROM INET_TBL;
|
||||||
|
SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)",
|
||||||
|
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL;
|
||||||
|
|
||||||
|
SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)",
|
||||||
|
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL
|
||||||
|
WHERE masklen(c) <= 8;
|
||||||
|
|
||||||
|
SELECT '' as six, c as cidr, i as inet FROM INET_TBL
|
||||||
|
WHERE c = i;
|
||||||
|
|
@ -24,6 +24,7 @@ reltime
|
|||||||
abstime
|
abstime
|
||||||
tinterval
|
tinterval
|
||||||
horology
|
horology
|
||||||
|
inet
|
||||||
comments
|
comments
|
||||||
create_function_1
|
create_function_1
|
||||||
create_type
|
create_type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user