<entry>2001:4f8:3:ba:&zwsp;2e0:81ff:fe22:d1f1/128</entry>
<entry>2001:4f8:3:ba:&zwsp;2e0:81ff:fe22:d1f1/128</entry>
<entry>2001:4f8:3:ba:&zwsp;2e0:81ff:fe22:d1f1/128</entry>
</row>
<row>
<entry>::ffff:1.2.3.0/120</entry>
<entry>::ffff:1.2.3.0/120</entry>
<entry>::ffff:1.2.3/120</entry>
</row>
<row>
<entry>::ffff:1.2.3.0/128</entry>
<entry>::ffff:1.2.3.0/128</entry>
<entry>::ffff:1.2.3.0/128</entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
<sect2 id="datatype-inet-vs-cidr">
<title><type>inet</type> vs. <type>cidr</type></title>
<para>
The essential difference between <type>inet</type> and <type>cidr</type>
data types is that <type>inet</type> accepts values with nonzero bits to
the right of the netmask, whereas <type>cidr</type> does not. For
example, <literal>192.168.0.1/24</literal> is valid for <type>inet</type>
but not for <type>cidr</type>.
</para>
<tip>
<para>
If you do not like the output format for <type>inet</type> or
<type>cidr</type> values, try the functions <function>host</function>,
<function>text</function>, and <function>abbrev</function>.
</para>
</tip>
</sect2>
<sect2 id="datatype-macaddr">
<title><type>macaddr</type></title>
<indexterm>
<primary>macaddr (data type)</primary>
</indexterm>
<indexterm>
<primary>MAC address</primary>
<see>macaddr</see>
</indexterm>
<para>
The <type>macaddr</type> type stores MAC addresses, known for example
from Ethernet card hardware addresses (although MAC addresses are
used for other purposes as well). Input is accepted in the
following formats:
<simplelist>
<member><literal>'08:00:2b:01:02:03'</literal></member>
<member><literal>'08-00-2b-01-02-03'</literal></member>
<member><literal>'08002b:010203'</literal></member>
<member><literal>'08002b-010203'</literal></member>
<member><literal>'0800.2b01.0203'</literal></member>
<member><literal>'0800-2b01-0203'</literal></member>
<member><literal>'08002b010203'</literal></member>
</simplelist>
These examples all specify the same address. Upper and
lower case is accepted for the digits
<literal>a</literal> through <literal>f</literal>. Output is always in the
first of the forms shown.
</para>
<para>
IEEE Standard 802-2001 specifies the second form shown (with hyphens)
as the canonical form for MAC addresses, and specifies the first
form (with colons) as used with bit-reversed, MSB-first notation, so that
08-00-2b-01-02-03 = 10:00:D4:80:40:C0. This convention is widely
ignored nowadays, and it is relevant only for obsolete network
protocols (such as Token Ring). PostgreSQL makes no provisions
for bit reversal; all accepted formats use the canonical LSB
order.
</para>
<para>
The remaining five input formats are not part of any standard.
</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> 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.