logoalt Hacker News

K0nservlast Sunday at 10:32 PM0 repliesview on HN

On Thursday I learned about ulid[0] which I think really neatly solves the problem of text representation for UUID v7. However, I also like the idea of prefixed ids, although I haven't used them in anger.

Yesterday I built most of a Postgres extension, using the excellent pgrx[1] project, that build on ulid to add prefixes. With it you get something like this

    plid=# SELECT gen_plid('u');
             gen_plid
    ---------------------------
     u_06DHRQH6SJT7N2WEQK4910R
    (1 row)
The aim is for it to be the same size as a UUID in storage, but I haven't quite gotten there yet.

I haven't pushed it to GitHub yet, but it's fairly done at this point.

0: https://github.com/ulid/spec

1: https://github.com/pgcentralfoundation/pgrx