diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/brin.sgml | 11 | ||||
-rw-r--r-- | doc/src/sgml/btree-gin.sgml | 3 | ||||
-rw-r--r-- | doc/src/sgml/btree-gist.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/datatype.sgml | 83 | ||||
-rw-r--r-- | doc/src/sgml/func.sgml | 56 |
5 files changed, 154 insertions, 3 deletions
diff --git a/doc/src/sgml/brin.sgml b/doc/src/sgml/brin.sgml index 6448b18e465..5bf11dc2d15 100644 --- a/doc/src/sgml/brin.sgml +++ b/doc/src/sgml/brin.sgml @@ -282,6 +282,17 @@ </entry> </row> <row> + <entry><literal>macaddr8_minmax_ops</literal></entry> + <entry><type>macaddr8</type></entry> + <entry> + <literal><</literal> + <literal><=</literal> + <literal>=</literal> + <literal>>=</literal> + <literal>></literal> + </entry> + </row> + <row> <entry><literal>name_minmax_ops</literal></entry> <entry><type>name</type></entry> <entry> diff --git a/doc/src/sgml/btree-gin.sgml b/doc/src/sgml/btree-gin.sgml index 2b081db9d5a..0de8eb5c309 100644 --- a/doc/src/sgml/btree-gin.sgml +++ b/doc/src/sgml/btree-gin.sgml @@ -16,7 +16,8 @@ <type>time without time zone</>, <type>date</>, <type>interval</>, <type>oid</>, <type>money</>, <type>"char"</>, <type>varchar</>, <type>text</>, <type>bytea</>, <type>bit</>, - <type>varbit</>, <type>macaddr</>, <type>inet</>, and <type>cidr</>. + <type>varbit</>, <type>macaddr</>, <type>macaddr8</>, <type>inet</>, + and <type>cidr</>. </para> <para> diff --git a/doc/src/sgml/btree-gist.sgml b/doc/src/sgml/btree-gist.sgml index d08647ce05a..cfdd5be84af 100644 --- a/doc/src/sgml/btree-gist.sgml +++ b/doc/src/sgml/btree-gist.sgml @@ -16,8 +16,8 @@ <type>time without time zone</>, <type>date</>, <type>interval</>, <type>oid</>, <type>money</>, <type>char</>, <type>varchar</>, <type>text</>, <type>bytea</>, <type>bit</>, - <type>varbit</>, <type>macaddr</>, <type>inet</>, <type>cidr</>, - and <type>uuid</>. + <type>varbit</>, <type>macaddr</>, <type>macaddr8</>, <type>inet</>, + <type>cidr</> and <type>uuid</>. </para> <para> diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 35610307d9a..e2f8dee7b66 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -167,6 +167,12 @@ </row> <row> + <entry><type>macaddr8</type></entry> + <entry></entry> + <entry>MAC (Media Access Control) address (EUI-64 format)</entry> + </row> + + <row> <entry><type>money</type></entry> <entry></entry> <entry>currency amount</entry> @@ -3428,6 +3434,12 @@ SELECT person.name, holidays.num_weeks FROM person, holidays <entry>MAC addresses</entry> </row> + <row> + <entry><type>macaddr8</type></entry> + <entry>8 bytes</entry> + <entry>MAC addresses (EUI-64 format)</entry> + </row> + </tbody> </tgroup> </table> @@ -3668,6 +3680,77 @@ SELECT person.name, holidays.num_weeks FROM person, holidays </para> </sect2> + <sect2 id="datatype-macaddr8"> + <title><type>macaddr8</type></title> + + <indexterm> + <primary>macaddr8 (data type)</primary> + </indexterm> + + <indexterm> + <primary>MAC address (EUI-64 format)</primary> + <see>macaddr</see> + </indexterm> + + <para> + The <type>macaddr8</> type stores MAC addresses in EUI-64 + format, known for example from Ethernet card hardware addresses + (although MAC addresses are used for other purposes as well). + This type can accept both 6 and 8 byte length MAC addresses + and stores them in 8 byte length format. MAC addresses given + in 6 byte format will be stored in 8 byte length format with the + 4th and 5th bytes set to FF and FE, respectively. + + Note that IPv6 uses a modified EUI-64 format where the 7th bit + should be set to one after the conversion from EUI-48. The + function <function>macaddr8_set7bit</> is provided to make this + change. + + Generally speaking, any input which is comprised of pairs of hex + digits (on byte boundaries), optionally separated consistently by + one of <literal>':'</>, <literal>'-'</> or <literal>'.'</>, is + accepted. The number of hex digits must be either 16 (8 bytes) or + 12 (6 bytes). Leading and trailing whitespace is ignored. + + The following are examples of input formats that are accepted: + + <simplelist> + <member><literal>'08:00:2b:01:02:03:04:05'</></member> + <member><literal>'08-00-2b-01-02-03-04-05'</></member> + <member><literal>'08002b:0102030405'</></member> + <member><literal>'08002b-0102030405'</></member> + <member><literal>'0800.2b01.0203.0405'</></member> + <member><literal>'0800-2b01-0203-0405'</></member> + <member><literal>'08002b01:02030405'</></member> + <member><literal>'08002b0102030405'</></member> + </simplelist> + + These examples would all specify the same address. Upper and + lower case is accepted for the digits + <literal>a</> through <literal>f</>. Output is always in the + first of the forms shown. + + The last six input formats that are mentioned above are not part + of any standard. + + To convert a traditional 48 bit MAC address in EUI-48 format to + modified EUI-64 format to be included as the host portion of an + IPv6 address, use <function>macaddr8_set7bit</> as shown: + +<programlisting> +SELECT macaddr8_set7bit('08:00:2b:01:02:03'); +<computeroutput> + macaddr8_set7bit +------------------------- + 0a:00:2b:ff:fe:01:02:03 +(1 row) +</computeroutput> +</programlisting> + + </para> + + </sect2> + </sect1> <sect1 id="datatype-bit"> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 583b3b241ab..a521912317b 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -9228,6 +9228,62 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple for NOT, AND and OR. </para> + <para> + <xref linkend="macaddr8-functions-table"> shows the functions + available for use with the <type>macaddr8</type> type. The function + <literal><function>trunc(<type>macaddr8</type>)</function></literal> returns a MAC + address with the last 5 bytes set to zero. This can be used to + associate the remaining prefix with a manufacturer. + </para> + + <table id="macaddr8-functions-table"> + <title><type>macaddr8</type> Functions</title> + <tgroup cols="5"> + <thead> + <row> + <entry>Function</entry> + <entry>Return Type</entry> + <entry>Description</entry> + <entry>Example</entry> + <entry>Result</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <indexterm> + <primary>trunc</primary> + </indexterm> + <literal><function>trunc(<type>macaddr8</type>)</function></literal> + </entry> + <entry><type>macaddr8</type></entry> + <entry>set last 5 bytes to zero</entry> + <entry><literal>trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')</literal></entry> + <entry><literal>12:34:56:00:00:00:00:00</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>macaddr8_set7bit</primary> + </indexterm> + <literal><function>macaddr8_set7bit(<type>macaddr8</type>)</function></literal> + </entry> + <entry><type>macaddr8</type></entry> + <entry>set 7th bit to one, also known as modified EUI-64, for inclusion in an IPv6 address</entry> + <entry><literal>macaddr8_set7bit(macaddr8 '00:34:56:ab:cd:ef')</literal></entry> + <entry><literal>02:34:56:ff:fe:ab:cd:ef</literal></entry> + </row> + </tbody> + </tgroup> + </table> + + <para> + The <type>macaddr8</type> type also supports the standard relational + operators (<literal>></literal>, <literal><=</literal>, etc.) for + ordering, and the bitwise arithmetic operators (<literal>~</literal>, + <literal>&</literal> and <literal>|</literal>) for NOT, AND and OR. + </para> + </sect1> |