text_domains
text_domains · Pure-SQL collection of constrained PostgreSQL text domains for nonempty, alphabetic, alphanumeric, case-specific, and fixed-length values.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100284 | text_domains | text_domains | 1.0 | TYPE | MIT | SQL |
PostgreSQL · 10
Usage
Sources:
text_domains version 1.0 defines 68 reusable PostgreSQL domains for nonempty text and fixed-shape alphanumeric, alphabetic, uppercase, lowercase, and digit strings. These domains centralize simple validation rules while retaining normal text storage and operators.
Core Workflow
Install the extension and use the domains directly in table definitions:
A value that does not satisfy the domain’s check constraint is rejected at assignment time.
Domain Families
nonempty_textrejects the empty string.alnumandnonempty_alnumaccept zero-or-more and one-or-more alphanumeric characters;alnum1through selected fixed widths such asalnum10,alnum16, andalnum22require exactly that many characters.alpha,upper,lower, anddigitprovide equivalent POSIX character-class families, including nonempty and fixed-width variants.- All patterned domains use
COLLATE "C"andSIMILAR TOchecks in the extension SQL.
Operational Caveats
Domain checks accept NULL unless the table column separately declares NOT NULL; even nonempty_text does not make a column non-null. The available fixed widths are an explicit, non-contiguous set in the SQL file, so inspect it rather than assuming every length exists. Character-class and collation behavior should be tested with the deployment encoding and representative non-ASCII input. Domain constraints are intentionally simple and do not normalize case, trim whitespace, or provide application-specific formats. Changing a shared domain constraint affects every dependent column and may require validating existing data first.