What data type is for storing the EUI-64 address in the (postgresql) database

What would be a good data type for storing an EUI-64 address (for ZigBee nodes)?

The EUI-64 address is basically 8 octets. From what I can assemble, they should not be considered integers as such, although, obviously, you can make a 64-bit integer from them. It seems obvious what to use bigint, although they are unfortunately β€œsigned”, which makes it a bit messy.

I could use numeric (8), but there are no built-in conversions to represent in hex (although I could write one).

I could use char (16), but that seems wasteful.

All of these options can be used, but each one seems a bit messy. I'm just wondering if anyone has any thoughts on this or on things that I did not think about. I am currently using bigint, which is still working fine. This allows me to use "to_hex" to represent the address, but I can anticipate problems if I do not handle the character correctly.

Thanks.

+4
source share
1 answer

I would write for myself my own data type, using the code for macaddras a template.

+1
source

All Articles