Updated on 2025-05-29 GMT+08:00

macaddr Functions

The trunc(macaddr) function returns a MAC address with the last 3 bytes set to zero.

trunc(macaddr)

Description: Sets last 3 bytes to zero.

Return type: macaddr

Example:

1
2
3
4
5
gaussdb=# SELECT trunc(macaddr '12:34:56:78:90:ab') AS RESULT;
      result       
-------------------
 12:34:56:00:00:00
(1 row)

The macaddr type also supports the standard relational operators (such as > and <=) for lexicographical ordering, and the bitwise arithmetic operators (~, & and |) for NOT, AND and OR.