italian_codes
italian_codes · Validation domains for Italian fiscal and VAT codes
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100224 | italian_codes | italian_codes | 1.0 | TYPE | BSD-3-Clause | SQL |
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
italian_codes provides text domains and validation functions for Italian fiscal codes: codice_fiscale accepts 16-character natural-person or 11-digit legal-person codes, and partita_iva accepts Italian VAT numbers. It validates supplied identifiers; it does not derive a fiscal code from personal data.
The constructor functions normalize whitespace, and codice_fiscale also uppercases input. Pass an explicitly typed text expression: PostgreSQL can interpret a bare literal such as codice_fiscale('X') as a domain literal and bypass the normalizing function.
Use codice_fiscale_error(text) or partita_iva_error(text) when validation errors should be returned as text instead of raised as check_violation; these helpers expect already-normalized input. The lower-level normalizers do not validate content, and validation messages are in Italian.
Fiscal-code generation is intentionally absent because omocodia can require a Revenue Service-issued alternative. Preserve the authoritative identifier, distinguish format validation from identity verification, and avoid treating either domain as proof that a person or business exists.