Search Shortcut cmd + k | ctrl + k
v0.10.0 (stable)
inet Extension

The inet extension defines the INET data type for storing IPv4 network addresses. It supports the CIDR notation for subnet masks (e.g., 198.51.100.0/22).

Installing and Loading

To install and load the inet extension, run:

INSTALL inet;
LOAD inet;

Examples

SELECT '127.0.0.1'::INET AS addr;
┌───────────┐
│   addr    │
│   inet    │
├───────────┤
│ 127.0.0.1 │
└───────────┘
CREATE TABLE tbl (id INTEGER, ip INET);
INSERT INTO tbl VALUES (1, '192.168.0.0/16'), (2, '127.0.0.1'), (2, '8.8.8.8');
┌───────┬────────────────┐
│  id   │       ip       │
│ int32 │      inet      │
├───────┼────────────────┤
│     1 │ 192.168.0.0/16 │
│     2 │ 127.0.0.1      │
│     2 │ 8.8.8.8        │
└───────┴────────────────┘

GitHub

The inet extension is part of the main DuckDB repository.

About this page

Last modified: 2024-02-27