pg_hashids
Short unique id generator for PostgreSQL, using hashids
pg_hashids : Short unique id generator for PostgreSQL, using hashids
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4550 | pg_hashids | pg_hashids | 1.3 |
FUNC | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | base36 base62 pg_base58 url_encode pg_slug_gen typeid pgqr |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| el8.aarch64 | N/A | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| el9.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| el9.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| el10.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| el10.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| d12.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| d12.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| d13.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| d13.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u22.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u22.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u24.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u24.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u26.x86_64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
| u26.aarch64 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 | PIGSTY 1.3 |
Source
github.com/iCyberon/pg_hashids
pg_hashids-1.3.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Converts numbers like 347 into strings like “yr8”. Useful for obfuscating database primary keys.
Functions
| Function | Description |
|---|---|
id_encode(number [, salt [, min_length [, alphabet]]]) |
Encode an integer to a hashid string |
id_decode(hash, salt, min_length [, alphabet]) |
Decode a hashid string back to integer array |
id_decode_once(hash [, salt [, min_length [, alphabet]]]) |
Decode a hashid string back to a single integer |