News for hackers. Stuff that matters.
Re:ULIDs and Primary Keys by SirensOfTitan on Thursday December 29, 2022 @05:11PM (#34178725)
I wouldn't use ULIDs on a new project. The spec doesn't seem like it has much stewardship, the last commit was in 2019 with a bunch of open PRs and issues: https://github.com/ulid/spec/issues

I went through this exploration a while back for a new project and decided on uuidv7s, which are binary compatible with ULIDs but will likely find more support as they get added to the original UUID RFC.

Either UUIDv7 or XIDs seem like better choices than ULIDs for new projects.

* Supabase on different primary key considerations: https://supabase.com/blog/choosing-a-postgres-primary-key

* Postgres extension for generating various kinds of IDs: https://github.com/VADOSWARE/pg_idkit

Re:ULIDs and Primary Keys by sedatk on Thursday December 29, 2022 @05:49PM (#34179166)
UUIDv7 (and v6, v8 for that matter) hasn't been approved by IETF yet though, has it?
Re:ULIDs and Primary Keys by dwaite on Thursday December 29, 2022 @07:58PM (#34180290)
Re:ULIDs and Primary Keys by codetrotter on Thursday December 29, 2022 @05:57PM (#34179240)
> the last commit was in 2019 with a bunch of open PRs and issues

I don’t see much of a problem with that. It’s a spec, and is probably considered complete by its authors. The issues and PRs are mostly people wanting to add links to more implementations of the spec to the README. That’s understandable but also not really necessary.

Re:ULIDs and Primary Keys by dwaite on Thursday December 29, 2022 @07:56PM (#34180278)
Per the original comment, that doesn't really show stewardship though.

If you do not believe a PR or issue to be valid, you close it. If you are literally not willing to accept any PRs or issues, turn the feature off.

Re:ULIDs and Primary Keys by codetrotter on Thursday December 29, 2022 @08:01PM (#34180304)
I’m not sure if it’s even possible to turn off PR for a repo on GitHub. One of the replies at https://stackoverflow.com/questions/27957454/how-to-disable-... seems to indicate that it is now possible since quite recently, but the linked post does not seem directly about disabling PRs.

Either way, we don’t know if they really don’t want any issues or PRs opened at all just because they have some old issues and PRs still open.

Re:ULIDs and Primary Keys by layer8 on Thursday December 29, 2022 @07:59PM (#34180296)
What does it matter, assuming the specification is clear and unambiguous?
Re:ULIDs and Primary Keys by dwaite on Monday January 02, 2023 @12:43AM (#34214767)
if it was clear, unambiguous, and had proper stewardship, there wouldn't be open issues and PRs.
Re:ULIDs and Primary Keys by RobertRoberts on Thursday December 29, 2022 @05:57PM (#34179244)
Why does the spec need updating? As far as I can tell it's finished. Maybe your concern is a little irrational?

(fyi, I am very happy user of ULID for years, I don't need libraries to be updated to keep using it)

I am wanting UUIDv7 but I can use ULID right now.

Re:ULIDs and Primary Keys by sedatk on Thursday December 29, 2022 @06:54PM (#34179772)
I'm not sure about parent's problem, but ULID spec has problems like "monotonic ID" which is just a counter, entirely breaking the universal thing.
Re:ULIDs and Primary Keys by RobertRoberts on Friday December 30, 2022 @09:07AM (#34185094)
From my experience this is only triggered when generating something like a thousand IDs a second (or more?), something I never run into in the systems I work on.

Since _every_ system has a down side or limitation, I am perfectly happy with ULID's flaws.

Why should there be disdain or dismissal of a system that solves many people's problems?

Re:ULIDs and Primary Keys by tomasreimers on Thursday December 29, 2022 @11:37PM (#34181834)
Finally! I have a question I've been dying to ask for some time.

Most of the time, when I hear people talking about UUIDs being better than big ints, it comes down to big ints leaking data (how many users / posts / comments your site has) and letting an attacker fetch sequential entries (user id 4 works, now try 5). This is even the reasoning in the supabase article. While ULIDs don't reveal the next entry, they do leak data (either creation date or number of entries, as all ULIDs are either prefixed with physical time or logical time).

Why don't we just encrypt / decrypt IDs when going over the wire (most API frameworks even have native methods to transform different types of data)? It suffers from neither issue above, is natively supported by API frameworks, and any time used on compute will be dwarfed by network latency. Is this already a pattern and I just don't know about it?

EDIT: ahh, below they list one advantage of UUIDs / ULIDs which is you can generate client side. That is reasonable.

Re:ULIDs and Primary Keys by andy_ppp on Friday December 30, 2022 @03:49AM (#34183231)
Great username, however ULIDs look good and I’d consider using them simply because they solve the problems UUID v7 attempts to solve while being considerably better in some regards and slightly worse in others. I think for my next project I’ll try them instead of UUIDv4.

In the end support for something this simple and complete isn’t something I’d have big concerns about.

Re:ULIDs and Primary Keys by mirzap on Friday December 30, 2022 @04:29AM (#34183453)
Thank you for posting pg_idkit. For months I was searching something like it. Supabase doing great things as well. They have couple others great PG extensions.