h2database / h2database

H2 is an embeddable RDBMS written in Java.
https://h2database.com
Other
4.17k stars 1.19k forks source link

Add optional version to RANDOM_UUID function and generator of version 7 in addition to existing version 4 #4005

Closed grandinj closed 1 month ago

grandinj commented 6 months ago

Improves performance when UUID is being used as primary key.

Spec https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format Discussion https://news.ycombinator.com/item?id=28088213

katzyn commented 6 months ago

What do you mean by a new data type? Our UUID data type can store values of all types.

RANDOM_UUID() function generates values with version (type) 4. java.util.UUID.randomUUID() has different implementation, but it also generates values of the same type.

In the most cases values are produced by JPA or by other persistence framework.

Anyway, we can create a new function or add an optional parameter to existing RANDOM_UUID() function to provide a built-in generator of UUIDs with different versions.

grandinj commented 6 months ago

Anyway, we can create a new function or add an optional parameter to existing RANDOM_UUID() function to provide a built-in generator of UUIDs with different versions.

Good point.

katzyn commented 1 month ago

A newer draft specification: https://datatracker.ietf.org/doc/html/draft-ietf-uuidrev-rfc4122bis

katzyn commented 1 month ago

https://datatracker.ietf.org/doc/html/rfc9562