Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8a657808
Commit
8a657808
authored
Oct 08, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update CIDR regresion tests to test for network masks inside the last
byte being tested, to catch any future breakage.
parent
7ca3a0f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
src/test/regress/expected/inet.out
src/test/regress/expected/inet.out
+12
-12
src/test/regress/sql/inet.sql
src/test/regress/sql/inet.sql
+3
-3
No files found.
src/test/regress/expected/inet.out
View file @
8a657808
...
...
@@ -6,7 +6,7 @@ DROP TABLE INET_TBL;
ERROR: table "inet_tbl" does not exist
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.0/2
4
', '192.168.1.226');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.0/2
6
', '192.168.1.226');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.0/24');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.0/25');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.255/24');
...
...
@@ -23,14 +23,14 @@ INSERT INTO INET_TBL (c, i) VALUES ('10:23::f1', '10:23::f1/64');
INSERT INTO INET_TBL (c, i) VALUES ('10:23::8000/113', '10:23::ffff');
INSERT INTO INET_TBL (c, i) VALUES ('::ffff:1.2.3.4', '::4.3.2.1/24');
-- check that CIDR rejects invalid input:
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/
24
', '192.168.1.226');
ERROR: invalid cidr value: "192.168.1.2/
24
"
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/
30
', '192.168.1.226');
ERROR: invalid cidr value: "192.168.1.2/
30
"
DETAIL: Value has bits set to right of mask.
INSERT INTO INET_TBL (c, i) VALUES ('1234::1234::1234', '::1.2.3.4');
ERROR: invalid input syntax for type cidr: "1234::1234::1234"
-- check that CIDR rejects invalid input when converting from text:
INSERT INTO INET_TBL (c, i) VALUES (cidr('192.168.1.2/
24
'), '192.168.1.226');
ERROR: invalid cidr value: "192.168.1.2/
24
"
INSERT INTO INET_TBL (c, i) VALUES (cidr('192.168.1.2/
30
'), '192.168.1.226');
ERROR: invalid cidr value: "192.168.1.2/
30
"
DETAIL: Value has bits set to right of mask.
INSERT INTO INET_TBL (c, i) VALUES (cidr('ffff:ffff:ffff:ffff::/24'), '::192.168.1.226');
ERROR: invalid cidr value: "ffff:ffff:ffff:ffff::/24"
...
...
@@ -39,7 +39,7 @@ SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
ten | cidr | inet
-----+--------------------+------------------
| 192.168.1.0/24 | 192.168.1.226/24
| 192.168.1.0/2
4
| 192.168.1.226
| 192.168.1.0/2
6
| 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
...
...
@@ -85,7 +85,7 @@ SELECT '' AS ten, c AS cidr, broadcast(c),
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/2
4 | 192.168.1.255/24
| 192.168.1.226 | 192.168.1.226
| 192.168.1.0/2
6 | 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
...
...
@@ -108,7 +108,7 @@ SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
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/2
4 | 192.168.1.0/24
| 192.168.1.226 | 192.168.1.226/32
| 192.168.1.0/2
6 | 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
...
...
@@ -131,7 +131,7 @@ SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
ten | cidr | masklen(cidr) | inet | masklen(inet)
-----+--------------------+---------------+------------------+---------------
| 192.168.1.0/24 | 24 | 192.168.1.226/24 | 24
| 192.168.1.0/2
4 | 24
| 192.168.1.226 | 32
| 192.168.1.0/2
6 | 26
| 192.168.1.226 | 32
| 192.168.1.0/24 | 24 | 192.168.1.0/24 | 24
| 192.168.1.0/24 | 24 | 192.168.1.0/25 | 25
| 192.168.1.0/24 | 24 | 192.168.1.255/24 | 24
...
...
@@ -177,7 +177,7 @@ SELECT '' AS ten, i, c,
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/2
4 | f | f | f | t | t | t | t | t
| f | f
| 192.168.1.226 | 192.168.1.0/2
6 | 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
...
...
@@ -226,7 +226,7 @@ SELECT * FROM inet_tbl WHERE i<<'192.168.1.0/24'::cidr;
----------------+------------------
192.168.1.0/24 | 192.168.1.0/25
192.168.1.0/24 | 192.168.1.255/25
192.168.1.0/2
4
| 192.168.1.226
192.168.1.0/2
6
| 192.168.1.226
(3 rows)
SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
...
...
@@ -237,7 +237,7 @@ SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
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.255/25
192.168.1.0/2
4
| 192.168.1.226
192.168.1.0/2
6
| 192.168.1.226
(6 rows)
SET enable_seqscan TO on;
...
...
src/test/regress/sql/inet.sql
View file @
8a657808
...
...
@@ -7,7 +7,7 @@
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.0/2
4
'
,
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1.0/2
6
'
,
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1'
,
'192.168.1.0/24'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1'
,
'192.168.1.0/25'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1'
,
'192.168.1.255/24'
);
...
...
@@ -24,10 +24,10 @@ INSERT INTO INET_TBL (c, i) VALUES ('10:23::f1', '10:23::f1/64');
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'10:23::8000/113'
,
'10:23::ffff'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'::ffff:1.2.3.4'
,
'::4.3.2.1/24'
);
-- check that CIDR rejects invalid input:
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1.2/
24
'
,
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1.2/
30
'
,
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'1234::1234::1234'
,
'::1.2.3.4'
);
-- check that CIDR rejects invalid input when converting from text:
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
cidr
(
'192.168.1.2/
24
'
),
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
cidr
(
'192.168.1.2/
30
'
),
'192.168.1.226'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
cidr
(
'ffff:ffff:ffff:ffff::/24'
),
'::192.168.1.226'
);
SELECT
''
AS
ten
,
c
AS
cidr
,
i
AS
inet
FROM
INET_TBL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment