salesforce_id
pg_salesforce_id · Compact 12-byte PostgreSQL type with casts, comparison operators, and B-tree/hash operator classes for Salesforce IDs.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100239 | salesforce_id | pg_salesforce_id | 1.0 | TYPE | PostgreSQL | C |
Usage
Sources:
salesforce_id provides a compact 12-byte PostgreSQL type for Salesforce object identifiers. It accepts the case-sensitive 15-character form and the case-insensitive 18-character form, normalizes output to 18 characters, and supplies comparison and index support for databases that store large numbers of Salesforce IDs.
Core Workflow
Create the extension, use the type at the schema boundary, and confirm that the two textual representations compare as the same identifier:
Input must use the Salesforce alphabet 0-9A-Za-z and have exactly 15 or 18 characters. The type defines implicit casts to and from text, so review overloaded expressions and application bindings carefully rather than relying on silent coercion.
Object Index
salesforce_idis the fixed-width identifier type.=and<>test equality and inequality.#<#,#<=#,#>#, and#>=#provide ordering comparisons.salesforce_id_opssupplies default B-tree and hash operator classes.gen_random_salesforce_id()andcheck_salesforce_id_internal()are diagnostic helpers from the upstream SQL, not a substitute for identifiers issued by Salesforce.
Caveats
The upstream README describes this release as experimental and not production-tested; the catalog also treats it as abandoned. Its stated storage saving is modest, and upstream does not establish a performance advantage. Validate canonical 18-character values at external boundaries, keep the original source identifier where reconciliation matters, and test dumps, restores, drivers, casts, sorting, and indexes on the exact PostgreSQL build before adopting this custom type.