MACADDR8
The MACADDR8
data type stores 8-byte (EUI-64 format) MAC addresses.
This data type accepts both 6-byte and 8-byte MAC addresses and stores them in 8-byte format. 6-byte addresses are stored with the 4th and 5th bytes set to FF
and FE
, respectively. All of the following 16-digit or 12-digit formats are valid, using colons, periods, or hyphens as separators (or no separator). Upper and lower case is accepted for the characters a
through f
. Leading and trailing whitespace is ignored.
All of these input values would result in the same MACADDR8
value being stored:
'08:00:2b:01:02:03:04:05'
'08-00-2b-01-02-03-04-05'
'08002b:0102030405'
'08002b-0102030405'
'0800.2b01.0203.0405'
'0800-2b01-0203-0405'
'08002b01:02030405'
'08002b0102030405'
Output is always returned in the first format (8 pairs of digits separated by colons):
08:00:2b:01:02:03:04:05
MACADDR8
columns do not accept empty strings.
The following example shows a MACADDR
value being inserted into a MACADDR8
column. The 4th and 5th bytes are set to FF
and FE
.
premdb=# insert into macaddr8s values('08:00:2b:01:02:03');
INSERT 0 1
premdb=# select * from macaddr8s;
c1
-------------------------
08:00:2b:ff:fe:01:02:03
(1 row)
To explicitly identify a string as a MACADDR8
literal value, use the MACADDR8
keyword. For example:
where mac_address > macaddr8 '08:00:2b:01:02:03:04:05'
See also Network Address Functions. To convert a 48-bit MAC address in EUI-48 format to modified EUI-64 format (as the host portion of an IPV6
address), use the MACADDR8_SET7BIT function.
Parent topic:SQL Data Types