IPv6¶
This data type isn't supported at ingest. It is only supported at query time and to create Copy Data Sources or Materialized View Data Sources.
IPv6 addresses. Stored in 16 bytes as UInt128 big-endian.
WITH (SELECT [('https://wikipedia.org', '::ffff:185.15.58.224'),('https://tinybird.co','::ffff:66.33.60.67'),('https://vercel.com','::ffff:64.239.109.193')]) AS ips SELECT arrayJoin(ips).1 as url, (arrayJoin(ips).2)::IPv6 as ipv6
------------------------------------------------- | url | ipv6 | ------------------------------------------------- | https://wikipedia.org | ::ffff:185.15.58.224 | | https://tinybird.co | ::ffff:66.33.60.67 | | https://vercel.com | ::ffff:64.239.109.193 | -------------------------------------------------
Values are stored in compact binary form:
WITH (SELECT [('https://wikipedia.org', '::ffff:185.15.58.224'),('https://tinybird.co','::ffff:66.33.60.67'),('https://vercel.com','::ffff:64.239.109.193')]) AS ips SELECT (arrayJoin(ips).2)::IPv6 as ipv6, toTypeName(ipv6), hex(ipv6)
------------------------------------------------------------------------------- | ipv6 | toTypeName(ipv6) | hex(ipv6) | ------------------------------------------------------------------------------- | ::ffff:185.15.58.224 | IPv6 | 00000000000000000000FFFFB90F3AE0 | | ::ffff:66.33.60.67 | IPv6 | 00000000000000000000FFFF42213C43 | | ::ffff:64.239.109.193 | IPv6 | 00000000000000000000FFFF40EF6DC1 | -------------------------------------------------------------------------------
IPv6 addresses can be directly compared to IPv4 addresses:
SELECT toIPv4('127.0.0.1') = toIPv6('::ffff:127.0.0.1')
----------------------------------------------------------- | equals(toIPv4('127.0.0.1'), toIPv6('::ffff:127.0.0.1')) | ----------------------------------------------------------- | 1 | -----------------------------------------------------------