url_encode

url_encode, url_decode functions

Overview

PackageVersionCategoryLicenseLanguage
url_encode1.2.5UTILPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
4190url_encodeNoYesNoYesNoYes-
Relatedpg_html5_email_address base36 base62 gzip bzip zstd http pg_net

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY1.2.51817161514url_encode-
RPMPIGSTY1.2.51817161514url_encode_$v-
DEBPIGSTY1.2.51817161514postgresql-$v-url-encode-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
d13.x86_64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
d13.aarch64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
u22.x86_64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
u22.aarch64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
u24.x86_64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
u24.aarch64
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5
PIGSTY 1.2.5

Build

You can build the RPM / DEB packages for url_encode using pig build:

pig build pkg url_encode         # build RPM / DEB packages

Install

You can install url_encode directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

pig install url_encode;          # Install for current active PG version
pig ext install -y url_encode -v 18  # PG 18
pig ext install -y url_encode -v 17  # PG 17
pig ext install -y url_encode -v 16  # PG 16
pig ext install -y url_encode -v 15  # PG 15
pig ext install -y url_encode -v 14  # PG 14
dnf install -y url_encode_18       # PG 18
dnf install -y url_encode_17       # PG 17
dnf install -y url_encode_16       # PG 16
dnf install -y url_encode_15       # PG 15
dnf install -y url_encode_14       # PG 14
apt install -y postgresql-18-url-encode   # PG 18
apt install -y postgresql-17-url-encode   # PG 17
apt install -y postgresql-16-url-encode   # PG 16
apt install -y postgresql-15-url-encode   # PG 15
apt install -y postgresql-14-url-encode   # PG 14

Create Extension:

CREATE EXTENSION url_encode;

Usage

url_encode: URL encoding and decoding functions for PostgreSQL

Functions

url_encode(text) returns text

Percent-encode a string for use in URLs:

SELECT url_encode('Hello World');
-- Hello%20World

SELECT url_encode('Ahoj Svetе');
-- Ahoj%20Sv%C4%9Bte

url_decode(text) returns text

Decode a percent-encoded string:

SELECT url_decode('Hello%20World');
-- Hello World

SELECT url_decode('Ahoj%20Sv%C4%9Bte');
-- Ahoj Svetе

uri_encode(text) returns text

Encode a full URI (preserves scheme, slashes, etc.):

SELECT uri_encode('http://hu.wikipedia.org/wiki/Sao_Paulo');
-- http://hu.wikipedia.org/wiki/S%C3%A3o_Paulo

uri_decode(text) returns text

Decode an encoded URI:

SELECT uri_decode('http://hu.wikipedia.org/wiki/S%C3%A3o_Paulo');
-- http://hu.wikipedia.org/wiki/Sao_Paulo

Last Modified 2026-03-12: add pg extension catalog (95749bf)