cas_codes
emi_monorepo · CAS Registry Number data type and validation support for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100806 | cas_codes | emi_monorepo | 0.1.0 | TYPE | GPL-3.0 | Rust |
PostgreSQL · 13, 14, 15, 16, 17
Usage
Sources:
cas_codes adds the CAS type for Chemical Abstracts Service Registry Numbers. Input is parsed with format and check-digit validation, making the type useful for rejecting malformed chemical identifiers at the database boundary.
Core Workflow
An invalid format or checksum is rejected by the type input function. The value is displayed in the conventional hyphenated form.
SQL Objects
CASis a variable-length custom type in the current PGRX build; the README notes that fixed-size custom types were not yet supported by its PGRX version.- Comparison operators
=,<>,<,<=,>, and>=are available. CAS_btree_opssupports B-tree ordering and uniqueness, whileCAS_hash_opssupports hashing.
Operational Notes
Version 0.1.0 is non-relocatable. Its control file sets superuser = true and trusted = false, so a superuser must create it; it declares no prerequisite extension or preload requirement. The generated SQL is tied to the PostgreSQL/PGRX build, so install matching control, SQL, and shared-library artifacts together before restoring schemas that use CAS.