uri

pg_uri : URI Data type for PostgreSQL

Overview

ID Extension Package Version Category License Language
3840
uri
pg_uri
1.20251029
TYPE
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
prefix
semver
unit
pgpdf
pglite_fusion
md5hash
asn1oid
roaringbitmap

+int flag

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
1.20251029
18
17
16
15
14
pg_uri -
RPM
PIGSTY
1.20251029
18
17
16
15
14
pg_uri_$v -
DEB
PIGSTY
1.20251029
18
17
16
15
14
postgresql-$v-pg-uri -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
el8.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
el9.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
el9.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
el10.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
el10.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
d12.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
d12.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
d13.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
d13.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
u22.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
u22.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
u24.x86_64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
u24.aarch64
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
PIGSTY 1.20251029
Package Version OS ORG SIZE File URL
pg_uri_18 1.20251029 el8.x86_64 pigsty 19.3 KiB pg_uri_18-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_18 1.20251029 el8.aarch64 pigsty 19.0 KiB pg_uri_18-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_18 1.20251029 el9.x86_64 pigsty 19.0 KiB pg_uri_18-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_18 1.20251029 el9.aarch64 pigsty 18.7 KiB pg_uri_18-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_18 1.20251029 el10.x86_64 pigsty 19.0 KiB pg_uri_18-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_18 1.20251029 el10.aarch64 pigsty 18.9 KiB pg_uri_18-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-uri 1.20251029 d12.x86_64 pigsty 21.6 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-uri 1.20251029 d12.aarch64 pigsty 21.4 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-uri 1.20251029 d13.x86_64 pigsty 21.8 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-uri 1.20251029 d13.aarch64 pigsty 21.5 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-uri 1.20251029 u22.x86_64 pigsty 22.8 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-uri 1.20251029 u22.aarch64 pigsty 22.4 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-uri 1.20251029 u24.x86_64 pigsty 22.7 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-18-pg-uri 1.20251029 u24.aarch64 pigsty 22.4 KiB postgresql-18-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_uri_17 1.20251029 el8.x86_64 pigsty 19.3 KiB pg_uri_17-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_17 1.20251029 el8.aarch64 pigsty 19.0 KiB pg_uri_17-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_17 1.20251029 el9.x86_64 pigsty 18.9 KiB pg_uri_17-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_17 1.20251029 el9.aarch64 pigsty 18.6 KiB pg_uri_17-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_17 1.20251029 el10.x86_64 pigsty 19.1 KiB pg_uri_17-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_17 1.20251029 el10.aarch64 pigsty 18.9 KiB pg_uri_17-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-17-pg-uri 1.20251029 d12.x86_64 pigsty 21.6 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-17-pg-uri 1.20251029 d12.aarch64 pigsty 21.4 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-17-pg-uri 1.20251029 d13.x86_64 pigsty 21.8 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-17-pg-uri 1.20251029 d13.aarch64 pigsty 21.5 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-17-pg-uri 1.20251029 u22.x86_64 pigsty 23.2 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-17-pg-uri 1.20251029 u22.aarch64 pigsty 23.0 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-17-pg-uri 1.20251029 u24.x86_64 pigsty 22.7 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-17-pg-uri 1.20251029 u24.aarch64 pigsty 22.4 KiB postgresql-17-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_uri_16 1.20251029 el8.x86_64 pigsty 19.3 KiB pg_uri_16-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_16 1.20251029 el8.aarch64 pigsty 19.0 KiB pg_uri_16-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_16 1.20251029 el9.x86_64 pigsty 18.9 KiB pg_uri_16-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_16 1.20251029 el9.aarch64 pigsty 18.6 KiB pg_uri_16-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_16 1.20251029 el10.x86_64 pigsty 19.1 KiB pg_uri_16-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_16 1.20251029 el10.aarch64 pigsty 18.9 KiB pg_uri_16-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-16-pg-uri 1.20251029 d12.x86_64 pigsty 21.6 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-16-pg-uri 1.20251029 d12.aarch64 pigsty 21.4 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-16-pg-uri 1.20251029 d13.x86_64 pigsty 21.8 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-16-pg-uri 1.20251029 d13.aarch64 pigsty 21.5 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-16-pg-uri 1.20251029 u22.x86_64 pigsty 23.2 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-16-pg-uri 1.20251029 u22.aarch64 pigsty 23.0 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-16-pg-uri 1.20251029 u24.x86_64 pigsty 22.7 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-16-pg-uri 1.20251029 u24.aarch64 pigsty 22.4 KiB postgresql-16-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_uri_15 1.20251029 el8.x86_64 pigsty 19.3 KiB pg_uri_15-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_15 1.20251029 el8.aarch64 pigsty 19.0 KiB pg_uri_15-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_15 1.20251029 el9.x86_64 pigsty 18.9 KiB pg_uri_15-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_15 1.20251029 el9.aarch64 pigsty 18.6 KiB pg_uri_15-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_15 1.20251029 el10.x86_64 pigsty 19.0 KiB pg_uri_15-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_15 1.20251029 el10.aarch64 pigsty 18.9 KiB pg_uri_15-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-15-pg-uri 1.20251029 d12.x86_64 pigsty 21.9 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-15-pg-uri 1.20251029 d12.aarch64 pigsty 21.3 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-15-pg-uri 1.20251029 d13.x86_64 pigsty 21.8 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-15-pg-uri 1.20251029 d13.aarch64 pigsty 21.4 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-15-pg-uri 1.20251029 u22.x86_64 pigsty 23.2 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-15-pg-uri 1.20251029 u22.aarch64 pigsty 23.1 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-15-pg-uri 1.20251029 u24.x86_64 pigsty 22.7 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-15-pg-uri 1.20251029 u24.aarch64 pigsty 22.3 KiB postgresql-15-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_uri_14 1.20251029 el8.x86_64 pigsty 19.2 KiB pg_uri_14-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_14 1.20251029 el8.aarch64 pigsty 19.0 KiB pg_uri_14-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_14 1.20251029 el9.x86_64 pigsty 18.8 KiB pg_uri_14-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_14 1.20251029 el9.aarch64 pigsty 18.6 KiB pg_uri_14-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_14 1.20251029 el10.x86_64 pigsty 19.0 KiB pg_uri_14-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_14 1.20251029 el10.aarch64 pigsty 18.9 KiB pg_uri_14-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-14-pg-uri 1.20251029 d12.x86_64 pigsty 21.8 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-14-pg-uri 1.20251029 d12.aarch64 pigsty 21.3 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-14-pg-uri 1.20251029 d13.x86_64 pigsty 21.8 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-14-pg-uri 1.20251029 d13.aarch64 pigsty 21.4 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-14-pg-uri 1.20251029 u22.x86_64 pigsty 23.2 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-14-pg-uri 1.20251029 u22.aarch64 pigsty 22.9 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-14-pg-uri 1.20251029 u24.x86_64 pigsty 22.6 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-14-pg-uri 1.20251029 u24.aarch64 pigsty 22.2 KiB postgresql-14-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb

Source

pig build pkg pg_uri;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_uri;		# install via package name, for the active PG version
pig install uri;		# install by extension name, for the current active PG version

pig install uri -v 18;   # install for PG 18
pig install uri -v 17;   # install for PG 17
pig install uri -v 16;   # install for PG 16
pig install uri -v 15;   # install for PG 15
pig install uri -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION uri;

Usage

uri: URI data type with validation and component extraction

The uri extension provides a data type for storing URIs with syntax validation per RFC 3986, component extraction functions, and human-friendly sorting.

CREATE EXTENSION uri;

CREATE TABLE links (
    id   int PRIMARY KEY,
    link uri
);

INSERT INTO links VALUES (1, 'https://github.com/petere/pguri');

Component Extraction Functions

Function Returns Description
uri_scheme(uri) text Scheme (http, ftp, mailto)
uri_userinfo(uri) text User info; NULL if absent
uri_host(uri) text Hostname or IP address
uri_host_inet(uri) inet IP host as inet; NULL if not IP
uri_port(uri) integer Port number; NULL if unspecified
uri_path(uri) text Path component (never NULL)
uri_path_array(uri) text[] Path split by /
uri_query(uri) text Query string; NULL if absent
uri_fragment(uri) text Fragment; NULL if absent

Utility Functions

-- Normalize URI per RFC 3986
SELECT uri_normalize('HTTP://Example.COM/foo/../bar');

-- Percent-encode text
SELECT uri_escape('hello world', true, false);  -- hello+world

-- Decode percent-encoded text
SELECT uri_unescape('hello+world', true, false);  -- hello world

Example

SELECT uri_scheme(link), uri_host(link), uri_path(link)
FROM links
WHERE uri_host(link) = 'github.com';
Last updated on