uri

pg_uri : URI Data type for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3840
uri
pg_uri
1.20251029
TYPE
PostgreSQL
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
prefix
semver
unit
pgpdf
pglite_fusion
md5hash
asn1oid
roaringbitmap

+int flag

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
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 / PGPG18PG17PG16PG15PG14
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
PackageVersionOSORGSIZEFile URL
pg_uri_181.20251029el8.x86_64pigsty19.3 KiBpg_uri_18-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_181.20251029el8.aarch64pigsty19.0 KiBpg_uri_18-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_181.20251029el9.x86_64pigsty19.0 KiBpg_uri_18-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_181.20251029el9.aarch64pigsty18.7 KiBpg_uri_18-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_181.20251029el10.x86_64pigsty19.0 KiBpg_uri_18-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_181.20251029el10.aarch64pigsty18.9 KiBpg_uri_18-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-uri1.20251029d12.x86_64pigsty21.6 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-uri1.20251029d12.aarch64pigsty21.4 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-uri1.20251029d13.x86_64pigsty21.8 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-uri1.20251029d13.aarch64pigsty21.5 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-uri1.20251029u22.x86_64pigsty22.8 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-uri1.20251029u22.aarch64pigsty22.4 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-uri1.20251029u24.x86_64pigsty22.7 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-18-pg-uri1.20251029u24.aarch64pigsty22.4 KiBpostgresql-18-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_uri_171.20251029el8.x86_64pigsty19.3 KiBpg_uri_17-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_171.20251029el8.aarch64pigsty19.0 KiBpg_uri_17-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_171.20251029el9.x86_64pigsty18.9 KiBpg_uri_17-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_171.20251029el9.aarch64pigsty18.6 KiBpg_uri_17-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_171.20251029el10.x86_64pigsty19.1 KiBpg_uri_17-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_171.20251029el10.aarch64pigsty18.9 KiBpg_uri_17-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-17-pg-uri1.20251029d12.x86_64pigsty21.6 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-17-pg-uri1.20251029d12.aarch64pigsty21.4 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-17-pg-uri1.20251029d13.x86_64pigsty21.8 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-17-pg-uri1.20251029d13.aarch64pigsty21.5 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-17-pg-uri1.20251029u22.x86_64pigsty23.2 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-17-pg-uri1.20251029u22.aarch64pigsty23.0 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-17-pg-uri1.20251029u24.x86_64pigsty22.7 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-17-pg-uri1.20251029u24.aarch64pigsty22.4 KiBpostgresql-17-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_uri_161.20251029el8.x86_64pigsty19.3 KiBpg_uri_16-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_161.20251029el8.aarch64pigsty19.0 KiBpg_uri_16-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_161.20251029el9.x86_64pigsty18.9 KiBpg_uri_16-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_161.20251029el9.aarch64pigsty18.6 KiBpg_uri_16-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_161.20251029el10.x86_64pigsty19.1 KiBpg_uri_16-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_161.20251029el10.aarch64pigsty18.9 KiBpg_uri_16-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-16-pg-uri1.20251029d12.x86_64pigsty21.6 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-16-pg-uri1.20251029d12.aarch64pigsty21.4 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-16-pg-uri1.20251029d13.x86_64pigsty21.8 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-16-pg-uri1.20251029d13.aarch64pigsty21.5 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-16-pg-uri1.20251029u22.x86_64pigsty23.2 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-16-pg-uri1.20251029u22.aarch64pigsty23.0 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-16-pg-uri1.20251029u24.x86_64pigsty22.7 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-16-pg-uri1.20251029u24.aarch64pigsty22.4 KiBpostgresql-16-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_uri_151.20251029el8.x86_64pigsty19.3 KiBpg_uri_15-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_151.20251029el8.aarch64pigsty19.0 KiBpg_uri_15-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_151.20251029el9.x86_64pigsty18.9 KiBpg_uri_15-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_151.20251029el9.aarch64pigsty18.6 KiBpg_uri_15-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_151.20251029el10.x86_64pigsty19.0 KiBpg_uri_15-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_151.20251029el10.aarch64pigsty18.9 KiBpg_uri_15-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-15-pg-uri1.20251029d12.x86_64pigsty21.9 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-15-pg-uri1.20251029d12.aarch64pigsty21.3 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-15-pg-uri1.20251029d13.x86_64pigsty21.8 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-15-pg-uri1.20251029d13.aarch64pigsty21.4 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-15-pg-uri1.20251029u22.x86_64pigsty23.2 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-15-pg-uri1.20251029u22.aarch64pigsty23.1 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-15-pg-uri1.20251029u24.x86_64pigsty22.7 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-15-pg-uri1.20251029u24.aarch64pigsty22.3 KiBpostgresql-15-pg-uri_1.20251029-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_uri_141.20251029el8.x86_64pigsty19.2 KiBpg_uri_14-1.20251029-1PIGSTY.el8.x86_64.rpm
pg_uri_141.20251029el8.aarch64pigsty19.0 KiBpg_uri_14-1.20251029-1PIGSTY.el8.aarch64.rpm
pg_uri_141.20251029el9.x86_64pigsty18.8 KiBpg_uri_14-1.20251029-1PIGSTY.el9.x86_64.rpm
pg_uri_141.20251029el9.aarch64pigsty18.6 KiBpg_uri_14-1.20251029-1PIGSTY.el9.aarch64.rpm
pg_uri_141.20251029el10.x86_64pigsty19.0 KiBpg_uri_14-1.20251029-1PIGSTY.el10.x86_64.rpm
pg_uri_141.20251029el10.aarch64pigsty18.9 KiBpg_uri_14-1.20251029-1PIGSTY.el10.aarch64.rpm
postgresql-14-pg-uri1.20251029d12.x86_64pigsty21.8 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~bookworm_amd64.deb
postgresql-14-pg-uri1.20251029d12.aarch64pigsty21.3 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~bookworm_arm64.deb
postgresql-14-pg-uri1.20251029d13.x86_64pigsty21.8 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~trixie_amd64.deb
postgresql-14-pg-uri1.20251029d13.aarch64pigsty21.4 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~trixie_arm64.deb
postgresql-14-pg-uri1.20251029u22.x86_64pigsty23.2 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~jammy_amd64.deb
postgresql-14-pg-uri1.20251029u22.aarch64pigsty22.9 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~jammy_arm64.deb
postgresql-14-pg-uri1.20251029u24.x86_64pigsty22.6 KiBpostgresql-14-pg-uri_1.20251029-1PIGSTY~noble_amd64.deb
postgresql-14-pg-uri1.20251029u24.aarch64pigsty22.2 KiBpostgresql-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

FunctionReturnsDescription
uri_scheme(uri)textScheme (http, ftp, mailto)
uri_userinfo(uri)textUser info; NULL if absent
uri_host(uri)textHostname or IP address
uri_host_inet(uri)inetIP host as inet; NULL if not IP
uri_port(uri)integerPort number; NULL if unspecified
uri_path(uri)textPath component (never NULL)
uri_path_array(uri)text[]Path split by /
uri_query(uri)textQuery string; NULL if absent
uri_fragment(uri)textFragment; 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