on-internet
← Community

How to set a seed for gen_random_uuid()?

Stack Overflow ·

For testing purposes on a table like this: CREATE TABLE my_table ( id UUID DEFAULT gen_random_uuid() PRIMARY KEY, . . ...I would like to get the same id's on each test run to better compare test logs / test results. Do there exist a function that works for gen_random_uuid() the same way setseed(x) works for random() ? gen_random_uuid() returns version 4 UUIDs that does not include timestamps so I can't see why this shouldn't be possible. I guess I could always write my own my_gen_random_uuid() based on random() with some hex string trickery, but that would be much slower. Example - the dice co

Comments

Sign in or sign up to comment and upvote.

No comments yet.