Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
8a657808
Commit
8a657808
authored
20 years ago
by
Bruce Momjian
Browse files
Options
Downloads
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
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/regress/expected/inet.out
+12
-12
12 additions, 12 deletions
src/test/regress/expected/inet.out
src/test/regress/sql/inet.sql
+3
-3
3 additions, 3 deletions
src/test/regress/sql/inet.sql
with
15 additions
and
15 deletions
src/test/regress/expected/inet.out
+
12
−
12
View file @
8a657808
...
@@ -6,7 +6,7 @@ DROP TABLE INET_TBL;
...
@@ -6,7 +6,7 @@ DROP TABLE INET_TBL;
ERROR: table "inet_tbl" does not exist
ERROR: table "inet_tbl" does not exist
CREATE TABLE INET_TBL (c cidr, i inet);
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', '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/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.0/25');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.255/24');
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');
...
@@ -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 ('10:23::8000/113', '10:23::ffff');
INSERT INTO INET_TBL (c, i) VALUES ('::ffff:1.2.3.4', '::4.3.2.1/24');
INSERT INTO INET_TBL (c, i) VALUES ('::ffff:1.2.3.4', '::4.3.2.1/24');
-- check that CIDR rejects invalid input:
-- 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');
ERROR: invalid cidr value: "192.168.1.2/
24
"
ERROR: invalid cidr value: "192.168.1.2/
30
"
DETAIL: Value has bits set to right of mask.
DETAIL: Value has bits set to right of mask.
INSERT INTO INET_TBL (c, i) VALUES ('1234::1234::1234', '::1.2.3.4');
INSERT INTO INET_TBL (c, i) VALUES ('1234::1234::1234', '::1.2.3.4');
ERROR: invalid input syntax for type cidr: "1234::1234::1234"
ERROR: invalid input syntax for type cidr: "1234::1234::1234"
-- check that CIDR rejects invalid input when converting from text:
-- 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');
ERROR: invalid cidr value: "192.168.1.2/
24
"
ERROR: invalid cidr value: "192.168.1.2/
30
"
DETAIL: Value has bits set to right of mask.
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');
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"
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;
...
@@ -39,7 +39,7 @@ SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
ten | cidr | inet
ten | cidr | inet
-----+--------------------+------------------
-----+--------------------+------------------
| 192.168.1.0/24 | 192.168.1.226/24
| 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/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/24
| 192.168.1.0/24 | 192.168.1.255/24
...
@@ -85,7 +85,7 @@ SELECT '' AS ten, c AS cidr, broadcast(c),
...
@@ -85,7 +85,7 @@ SELECT '' AS ten, c AS cidr, broadcast(c),
ten | cidr | broadcast | inet | broadcast
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/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/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.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/24 | 192.168.1.255/24
...
@@ -108,7 +108,7 @@ SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
...
@@ -108,7 +108,7 @@ SELECT '' AS ten, c AS cidr, network(c) AS "network(cidr)",
ten | cidr | network(cidr) | inet | network(inet)
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/2
4
| 192.168.1.0/2
4
| 192.168.1.226 | 192.168.1.226/32
| 192.168.1.0/2
6
| 192.168.1.0/2
6
| 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/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.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/24 | 192.168.1.0/24
...
@@ -131,7 +131,7 @@ SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
...
@@ -131,7 +131,7 @@ SELECT '' AS ten, c AS cidr, masklen(c) AS "masklen(cidr)",
ten | cidr | masklen(cidr) | inet | masklen(inet)
ten | cidr | masklen(cidr) | inet | masklen(inet)
-----+--------------------+---------------+------------------+---------------
-----+--------------------+---------------+------------------+---------------
| 192.168.1.0/24 | 24 | 192.168.1.226/24 | 24
| 192.168.1.0/24 | 24 | 192.168.1.226/24 | 24
| 192.168.1.0/2
4
| 2
4
| 192.168.1.226 | 32
| 192.168.1.0/2
6
| 2
6
| 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/24 | 24
| 192.168.1.0/24 | 24 | 192.168.1.0/25 | 25
| 192.168.1.0/24 | 24 | 192.168.1.0/25 | 25
| 192.168.1.0/24 | 24 | 192.168.1.255/24 | 24
| 192.168.1.0/24 | 24 | 192.168.1.255/24 | 24
...
@@ -177,7 +177,7 @@ SELECT '' AS ten, i, c,
...
@@ -177,7 +177,7 @@ SELECT '' AS ten, i, c,
ten | i | c | lt | le | eq | ge | gt | ne | sb | sbe | sup | spe
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/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/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.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/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;
...
@@ -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.0/25
192.168.1.0/24 | 192.168.1.255/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)
(3 rows)
SELECT * FROM inet_tbl WHERE i<<='192.168.1.0/24'::cidr;
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;
...
@@ -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.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/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)
(6 rows)
SET enable_seqscan TO on;
SET enable_seqscan TO on;
...
...
This diff is collapsed.
Click to expand it.
src/test/regress/sql/inet.sql
+
3
−
3
View file @
8a657808
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
DROP
TABLE
INET_TBL
;
DROP
TABLE
INET_TBL
;
CREATE
TABLE
INET_TBL
(
c
cidr
,
i
inet
);
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'
,
'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/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.0/25'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'192.168.1'
,
'192.168.1.255/24'
);
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');
...
@@ -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
(
'10:23::8000/113'
,
'10:23::ffff'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'::ffff:1.2.3.4'
,
'::4.3.2.1/24'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'::ffff:1.2.3.4'
,
'::4.3.2.1/24'
);
-- check that CIDR rejects invalid input:
-- 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'
);
INSERT
INTO
INET_TBL
(
c
,
i
)
VALUES
(
'1234::1234::1234'
,
'::1.2.3.4'
);
-- check that CIDR rejects invalid input when converting from text:
-- 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'
);
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
;
SELECT
''
AS
ten
,
c
AS
cidr
,
i
AS
inet
FROM
INET_TBL
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment