cidr and inet Operators
The operators <<, <<=, >>, and >>= test for subnet inclusion. They consider only the network parts of the two addresses (ignoring any host part) and determine whether one network is identical to or a subnet of the other.
<
Description: Is less than
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' < inet '192.168.1.6' AS RESULT; result -------- t (1 row) |
<=
Description: Is less than or equals
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' <= inet '192.168.1.5' AS RESULT; result -------- t (1 row) |
=
Description: Equals
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' = inet '192.168.1.5' AS RESULT; result -------- t (1 row) |
>=
Description: Is greater than or equals
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' >= inet '192.168.1.5' AS RESULT; result -------- t (1 row) |
>
Description: Is greater than
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' > inet '192.168.1.4' AS RESULT; result -------- t (1 row) |
<>
Description: Does not equal
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' <> inet '192.168.1.4' AS RESULT; result -------- t (1 row) |
<<
Description: Is contained in
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.5' << inet '192.168.1/24' AS RESULT; result -------- t (1 row) |
<<=
Description: Is contained in or equals
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1/24' <<= inet '192.168.1/24' AS RESULT; result -------- t (1 row) |
>>
Description: Contains
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1/24' >> inet '192.168.1.5' AS RESULT; result -------- t (1 row) |
>>=
Description: Contains or equals
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1/24' >>= inet '192.168.1/24' AS RESULT; result -------- t (1 row) |
~
Description: Bitwise NOT
Example:
1 2 3 4 5 |
gaussdb=# SELECT ~ inet '192.168.1.6' AS RESULT; result --------------- 63.87.254.249 (1 row) |
&
Description: Performs an AND operation on each bit of the two network addresses.
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.6' & inet '10.0.0.0' AS RESULT; result --------- 0.0.0.0 (1 row) |
|
Description: Performs an OR operation on each bit of the two network addresses.
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.6' | inet '10.0.0.0' AS RESULT; result ------------- 202.168.1.6 (1 row) |
+
Description: Addition
Example:
1 2 3 4 5 |
gaussdb=# SELECT inet '192.168.1.6' + 25 AS RESULT; result -------------- 192.168.1.31 (1 row) |
-
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot