pg_html5_email_address
pg_html5_email_address
pg_html5_email_address : PostgreSQL email validation that is consistent with the HTML5 spec
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4180 | pg_html5_email_address | pg_html5_email_address | 1.2.3 | UTIL | PostgreSQL | SQL |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
----d-r | No | No | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_smtp_client url_encode pg_render gzip bzip zstd http pg_net |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.2.3 | 18 17 16 15 14 | pg_html5_email_address | - |
| RPM | PIGSTY | 1.2.3 | 18 17 16 15 14 | pg_html5_email_address_$v | - |
| DEB | PIGSTY | 1.2.3 | 18 17 16 15 14 | postgresql-$v-pg-html5-email-address | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
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 |
Source
pig build pkg pg_html5_email_address; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pg_html5_email_address; # install via package name, for the active PG version
pig install pg_html5_email_address -v 18; # install for PG 18
pig install pg_html5_email_address -v 17; # install for PG 17
pig install pg_html5_email_address -v 16; # install for PG 16
pig install pg_html5_email_address -v 15; # install for PG 15
pig install pg_html5_email_address -v 14; # install for PG 14Create this extension with:
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 'user@example.com'::html5_email;
-- Case-insensitive equality:
SELECT 'User@Example.com'::html5_email = 'user@example.com'::html5_email;
-- t
-- Invalid emails raise check_violation:
SELECT 'user @example.com'::html5_email;
-- ERROR: check_violationFunction: html5_email_regexp()
Returns a regex matching valid HTML5 email addresses:
-- Check if a string is a valid HTML5 email
SELECT 'user@example.com' ~ html5_email_regexp();
-- t
SELECT 'user @example.com' ~ html5_email_regexp();
-- fWith optional capturing groups for local and domain parts:
SELECT (regexp_matches('user@example.com', html5_email_regexp(true)))[1];
-- 'user'
SELECT (regexp_matches('user@example.com', 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 updated on