pg_html5_email_address

PostgreSQL email validation that is consistent with the HTML5 spec

Overview

PackageVersionCategoryLicenseLanguage
pg_html5_email_address1.2.3UTILPostgreSQLSQL
IDExtensionBinLibLoadCreateTrustRelocSchema
4180pg_html5_email_addressNoNoNoYesNoYes-
Relatedpg_smtp_client url_encode pg_render gzip bzip zstd http pg_net

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY1.2.31817161514pg_html5_email_address-
RPMPIGSTY1.2.31817161514pg_html5_email_address_$v-
DEBPIGSTY1.2.31817161514postgresql-$v-pg-html5-email-address-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el8.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el9.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el9.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el10.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el10.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d12.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d12.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d13.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d13.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u22.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u22.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u24.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u24.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3

Build

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

pig build pkg pg_html5_email_address         # build RPM / DEB packages

Install

You can install pg_html5_email_address 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 pg_html5_email_address;          # Install for current active PG version
pig ext install -y pg_html5_email_address -v 18  # PG 18
pig ext install -y pg_html5_email_address -v 17  # PG 17
pig ext install -y pg_html5_email_address -v 16  # PG 16
pig ext install -y pg_html5_email_address -v 15  # PG 15
pig ext install -y pg_html5_email_address -v 14  # PG 14
dnf install -y pg_html5_email_address_18       # PG 18
dnf install -y pg_html5_email_address_17       # PG 17
dnf install -y pg_html5_email_address_16       # PG 16
dnf install -y pg_html5_email_address_15       # PG 15
dnf install -y pg_html5_email_address_14       # PG 14
apt install -y postgresql-18-pg-html5-email-address   # PG 18
apt install -y postgresql-17-pg-html5-email-address   # PG 17
apt install -y postgresql-16-pg-html5-email-address   # PG 16
apt install -y postgresql-15-pg-html5-email-address   # PG 15
apt install -y postgresql-14-pg-html5-email-address   # PG 14

Create Extension:

CREATE EXTENSION pg_html5_email_address;

Usage

pg_html5_email_address: HTML5 email address validation for PostgreSQL

Provides email address validation consistent with the HTML5 <input type="email"> specification.

Domain Type: html5_email

A domain type that enforces HTML5 email validation rules with case-insensitive comparison:

SELECT '[email protected]'::html5_email;

-- Case-insensitive equality:
SELECT '[email protected]'::html5_email = '[email protected]'::html5_email;
-- t

-- Invalid emails raise check_violation:
SELECT 'user @example.com'::html5_email;
-- ERROR: check_violation

Function: html5_email_regexp()

Returns a regex matching valid HTML5 email addresses:

-- Check if a string is a valid HTML5 email
SELECT '[email protected]' ~ html5_email_regexp();
-- t

SELECT 'user @example.com' ~ html5_email_regexp();
-- f

With optional capturing groups for local and domain parts:

SELECT (regexp_matches('[email protected]', html5_email_regexp(true)))[1];
-- 'user'
SELECT (regexp_matches('[email protected]', html5_email_regexp(true)))[2];
-- 'example.com'

Validation Rules

  • Spaces are not allowed
  • Non-ASCII characters are not allowed (neither in local nor domain part)
  • There must be something after the @
  • Special characters like !#$%&'*+/=?^_{|}~-` are allowed in the local part

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