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
ca2995be
Commit
ca2995be
authored
Oct 22, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicate CIDR funcs by using coerce entries.
parent
9ac0c1e3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
94 deletions
+50
-94
src/backend/parser/parse_coerce.c
src/backend/parser/parse_coerce.c
+10
-1
src/backend/utils/adt/inet.c
src/backend/utils/adt/inet.c
+8
-32
src/include/catalog/pg_amop.h
src/include/catalog/pg_amop.h
+6
-6
src/include/catalog/pg_operator.h
src/include/catalog/pg_operator.h
+1
-2
src/include/catalog/pg_proc.h
src/include/catalog/pg_proc.h
+7
-37
src/include/catalog/pg_type.h
src/include/catalog/pg_type.h
+3
-1
src/include/parser/parse_coerce.h
src/include/parser/parse_coerce.h
+10
-4
src/include/utils/builtins.h
src/include/utils/builtins.h
+5
-11
No files found.
src/backend/parser/parse_coerce.c
View file @
ca2995be
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.
8 1998/10/08 18:29:43
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.
9 1998/10/22 13:50:54
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -328,6 +328,11 @@ TypeCategory(Oid inType)
result
=
GEOMETRIC_TYPE
;
break
;
case
(
INETOID
):
case
(
CIDROID
):
result
=
NETWORK_TYPE
;
break
;
default:
result
=
USER_TYPE
;
break
;
...
...
@@ -379,6 +384,10 @@ PreferredType(CATEGORY category, Oid type)
result
=
TIMESPANOID
;
break
;
case
(
NETWORK_TYPE
):
result
=
INETOID
;
break
;
case
(
GEOMETRIC_TYPE
):
case
(
USER_TYPE
):
result
=
type
;
...
...
src/backend/utils/adt/inet.c
View file @
ca2995be
...
...
@@ -3,7 +3,7 @@
* is for IP V4 CIDR notation, but prepared for V6: just
* add the necessary bits where the comments indicate.
*
* $Id: inet.c,v 1.1
2 1998/10/22 13:16:23
momjian Exp $
* $Id: inet.c,v 1.1
3 1998/10/22 13:50:56
momjian Exp $
* Jon Postel RIP 16 Oct 1998
*/
...
...
@@ -297,7 +297,7 @@ inet_cmp(inet *a1, inet *a2)
}
text
*
inet_
host
(
inet
*
ip
)
host
(
inet
*
ip
)
{
text
*
ret
;
int
len
;
...
...
@@ -331,7 +331,7 @@ inet_host(inet *ip)
ret
=
palloc
(
len
);
if
(
ret
==
NULL
)
{
elog
(
ERROR
,
"unable to allocate memory in
inet_
host()"
);
elog
(
ERROR
,
"unable to allocate memory in host()"
);
return
(
NULL
);
}
VARSIZE
(
ret
)
=
len
;
...
...
@@ -339,26 +339,14 @@ inet_host(inet *ip)
return
(
ret
);
}
text
*
cidr_host
(
inet
*
ip
)
{
return
inet_host
(
ip
);
}
int4
inet_net
masklen
(
inet
*
ip
)
masklen
(
inet
*
ip
)
{
return
ip_bits
(
ip
);
}
int4
cidr_netmasklen
(
inet
*
ip
)
{
return
inet_netmasklen
(
ip
);
}
text
*
inet_
broadcast
(
inet
*
ip
)
broadcast
(
inet
*
ip
)
{
text
*
ret
;
int
len
;
...
...
@@ -390,7 +378,7 @@ inet_broadcast(inet *ip)
ret
=
palloc
(
len
);
if
(
ret
==
NULL
)
{
elog
(
ERROR
,
"unable to allocate memory in
inet_
broadcast()"
);
elog
(
ERROR
,
"unable to allocate memory in broadcast()"
);
return
(
NULL
);
}
VARSIZE
(
ret
)
=
len
;
...
...
@@ -399,13 +387,7 @@ inet_broadcast(inet *ip)
}
text
*
cidr_broadcast
(
inet
*
ip
)
{
return
inet_broadcast
(
ip
);
}
text
*
inet_netmask
(
inet
*
ip
)
netmask
(
inet
*
ip
)
{
text
*
ret
;
int
len
;
...
...
@@ -435,7 +417,7 @@ inet_netmask(inet *ip)
ret
=
palloc
(
len
);
if
(
ret
==
NULL
)
{
elog
(
ERROR
,
"unable to allocate memory in
inet_
netmask()"
);
elog
(
ERROR
,
"unable to allocate memory in netmask()"
);
return
(
NULL
);
}
VARSIZE
(
ret
)
=
len
;
...
...
@@ -443,12 +425,6 @@ inet_netmask(inet *ip)
return
(
ret
);
}
text
*
cidr_netmask
(
inet
*
ip
)
{
return
inet_netmask
(
ip
);
}
/*
* Bitwise comparison for V4 addresses. Add V6 implementation!
*/
...
...
src/include/catalog/pg_amop.h
View file @
ca2995be
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_amop.h,v 1.1
7 1998/10/22 05:29:23
momjian Exp $
* $Id: pg_amop.h,v 1.1
8 1998/10/22 13:50:58
momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -322,11 +322,11 @@ DATA(insert OID = 0 ( 403 935 1205 5 btreesel btreenpage ));
* nbtree cidr
*/
DATA
(
insert
OID
=
0
(
403
652
822
1
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
823
2
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
820
3
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
825
4
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
824
5
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
1203
1
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
1204
2
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
1201
3
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
1206
4
btreesel
btreenpage
));
DATA
(
insert
OID
=
0
(
403
652
1205
5
btreesel
btreenpage
));
/*
* hash table _ops
...
...
src/include/catalog/pg_operator.h
View file @
ca2995be
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_operator.h,v 1.4
1 1998/10/21 16:06:46
momjian Exp $
* $Id: pg_operator.h,v 1.4
2 1998/10/22 13:51:00
momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -667,7 +667,6 @@ DATA(insert OID = 827 ( "<<=" PGUID 0 b t f 650 650 16 1004 828 0 0 in
DATA
(
insert
OID
=
828
(
">>"
PGUID
0
b
t
f
650
650
16
826
827
0
0
inet_sup
intltsel
intltjoinsel
));
DATA
(
insert
OID
=
1004
(
">>="
PGUID
0
b
t
f
650
650
16
827
826
0
0
inet_supeq
intltsel
intltjoinsel
));
/*
* function prototypes
*/
...
...
src/include/catalog/pg_proc.h
View file @
ca2995be
1
/*-------------------------------------------------------------------------
/*-------------------------------------------------------------------------
*
* pg_proc.h--
* definition of the system "procedure" relation (pg_proc)
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.
79 1998/10/22 05:29:24
momjian Exp $
* $Id: pg_proc.h,v 1.
80 1998/10/22 13:51:02
momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
...
...
@@ -2104,44 +2104,14 @@ DESCR("is-supernet");
DATA
(
insert
OID
=
930
(
inet_supeq
PGUID
11
f
t
f
2
f
16
"869 869"
100
0
0
100
foo
bar
));
DESCR
(
"is-supernet-or-equal"
);
/* inet
base
versions */
DATA
(
insert
OID
=
940
(
inet_netmask
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
/* inet
/cidr
versions */
DATA
(
insert
OID
=
940
(
netmask
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
DESCR
(
"netmask of address"
);
DATA
(
insert
OID
=
941
(
inet_netmasklen
PGUID
11
f
t
f
1
f
23
"869"
100
0
0
100
foo
bar
));
DATA
(
insert
OID
=
941
(
masklen
PGUID
11
f
t
f
1
f
23
"869"
100
0
0
100
foo
bar
));
DESCR
(
"netmask length"
);
DATA
(
insert
OID
=
945
(
inet_broadcast
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
DATA
(
insert
OID
=
945
(
broadcast
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
DESCR
(
"broadcast address"
);
DATA
(
insert
OID
=
682
(
inet_host
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
DESCR
(
"host address"
);
/* cidr base versions */
DATA
(
insert
OID
=
1619
(
cidr_netmask
PGUID
11
f
t
f
1
f
25
"650"
100
0
0
100
foo
bar
));
DESCR
(
"netmask of address"
);
DATA
(
insert
OID
=
1620
(
cidr_netmasklen
PGUID
11
f
t
f
1
f
23
"650"
100
0
0
100
foo
bar
));
DESCR
(
"netmask length"
);
DATA
(
insert
OID
=
1621
(
cidr_broadcast
PGUID
11
f
t
f
1
f
25
"650"
100
0
0
100
foo
bar
));
DESCR
(
"broadcast address"
);
DATA
(
insert
OID
=
1622
(
cidr_host
PGUID
11
f
t
f
1
f
25
"650"
100
0
0
100
foo
bar
));
DESCR
(
"host address"
);
/* inet versions */
DATA
(
insert
OID
=
946
(
netmask
PGUID
14
f
t
f
1
f
25
"869"
100
0
0
100
"select inet_netmask($1)"
-
));
DESCR
(
"netmask of address"
);
DATA
(
insert
OID
=
947
(
netmasklen
PGUID
14
f
t
f
1
f
23
"869"
100
0
0
100
"select inet_netmasklen($1)"
-
));
DESCR
(
"netmask length"
);
DATA
(
insert
OID
=
948
(
broadcast
PGUID
14
f
t
f
1
f
25
"869"
100
0
0
100
"select inet_broadcast($1)"
-
));
DESCR
(
"broadcast address"
);
DATA
(
insert
OID
=
949
(
host
PGUID
14
f
t
f
1
f
25
"869"
100
0
0
100
"select inet_host($1)"
-
));
DESCR
(
"host address"
);
/* cidr versions */
DATA
(
insert
OID
=
696
(
netmask
PGUID
14
f
t
f
1
f
25
"650"
100
0
0
100
"select cidr_netmask($1)"
-
));
DESCR
(
"netmask of address"
);
DATA
(
insert
OID
=
697
(
netmasklen
PGUID
14
f
t
f
1
f
23
"650"
100
0
0
100
"select cidr_netmasklen($1)"
-
));
DESCR
(
"netmask length"
);
DATA
(
insert
OID
=
698
(
broadcast
PGUID
14
f
t
f
1
f
25
"650"
100
0
0
100
"select cidr_broadcast($1)"
-
));
DESCR
(
"broadcast address"
);
DATA
(
insert
OID
=
699
(
host
PGUID
14
f
t
f
1
f
25
"650"
100
0
0
100
"select cidr_host($1)"
-
));
DATA
(
insert
OID
=
682
(
host
PGUID
11
f
t
f
1
f
25
"869"
100
0
0
100
foo
bar
));
DESCR
(
"host address"
);
...
...
src/include/catalog/pg_type.h
View file @
ca2995be
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_type.h,v 1.5
1 1998/10/22 00:35:26
momjian Exp $
* $Id: pg_type.h,v 1.5
2 1998/10/22 13:51:03
momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -302,8 +302,10 @@ DATA(insert OID = 829 ( macaddr PGUID 6 -1 f b t \054 0 0 macaddr_in macaddr
DESCR
(
"MAC address"
);
DATA
(
insert
OID
=
869
(
inet
PGUID
-
1
-
1
f
b
t
\
054
0
0
inet_in
inet_out
inet_in
inet_out
i
_null_
));
DESCR
(
"Host address"
);
#define INETOID 869
DATA
(
insert
OID
=
650
(
cidr
PGUID
-
1
-
1
f
b
t
\
054
0
0
cidr_in
cidr_out
cidr_in
cidr_out
i
_null_
));
DESCR
(
"Network address"
);
#define CIDROID 650
/* OIDS 900 - 999 */
...
...
src/include/parser/parse_coerce.h
View file @
ca2995be
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parse_coerce.h,v 1.
6 1998/10/08 18:30:36
momjian Exp $
* $Id: parse_coerce.h,v 1.
7 1998/10/22 13:51:05
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -23,6 +23,7 @@ typedef enum CATEGORY
DATETIME_TYPE
,
TIMESPAN_TYPE
,
GEOMETRIC_TYPE
,
NETWORK_TYPE
,
USER_TYPE
,
MIXED_TYPE
}
CATEGORY
;
...
...
@@ -56,7 +57,9 @@ typedef enum CATEGORY
|| ((t) == BOXOID) \
|| ((t) == PATHOID) \
|| ((t) == POLYGONOID) \
|| ((t) == CIRCLEOID))
|| ((t) == CIRCLEOID) \
|| ((t) == INETOID) \
|| ((t) == CIDROID) )
/* IS_BINARY_COMPATIBLE()
...
...
@@ -83,7 +86,9 @@ typedef enum CATEGORY
|| ((a) == INT4OID && (b) == ABSTIMEOID) \
|| ((a) == INT4OID && (b) == TIMESTAMPOID) \
|| ((a) == RELTIMEOID && (b) == INT4OID) \
|| ((a) == INT4OID && (b) == RELTIMEOID))
|| ((a) == INT4OID && (b) == RELTIMEOID) \
|| ((a) == INETOID && (b) == CIDROID) \
|| ((a) == CIDROID && (b) == INETOID))
/* IS_HIGHER_TYPE()
* These types are the most general in each of the type categories.
...
...
@@ -93,7 +98,8 @@ typedef enum CATEGORY
|| ((t) == FLOAT8OID) \
|| ((t) == TIMESPANOID) \
|| ((t) == DATETIMEOID) \
|| ((t) == POLYGONOID))
|| ((t) == POLYGONOID) \
|| ((t) == INETOID) )
/* IS_HIGHEST_TYPE()
* These types are the most general in each of the type categories.
...
...
src/include/utils/builtins.h
View file @
ca2995be
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: builtins.h,v 1.6
6 1998/10/22 13:16:2
7 momjian Exp $
* $Id: builtins.h,v 1.6
7 1998/10/22 13:51:0
7 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
...
...
@@ -533,16 +533,10 @@ bool inet_sup(inet * a1, inet * a2);
bool
inet_supeq
(
inet
*
a1
,
inet
*
a2
);
int4
inet_cmp
(
inet
*
a1
,
inet
*
a2
);
text
*
inet_netmask
(
inet
*
addr
);
int4
inet_netmasklen
(
inet
*
addr
);
text
*
inet_broadcast
(
inet
*
addr
);
text
*
inet_host
(
inet
*
addr
);
text
*
cidr_netmask
(
inet
*
addr
);
int4
cidr_netmasklen
(
inet
*
addr
);
text
*
cidr_broadcast
(
inet
*
addr
);
text
*
cidr_host
(
inet
*
addr
);
text
*
netmask
(
inet
*
addr
);
int4
masklen
(
inet
*
addr
);
text
*
broadcast
(
inet
*
addr
);
text
*
host
(
inet
*
addr
);
/* mac.c */
macaddr
*
macaddr_in
(
char
*
str
);
...
...
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