Exercise extreme caution.
Having your security strategy rely on quirky behaviors of an implementation detail which might change is incredibly dangerous.
Having your security strategy rely on quirky behaviors of an implementation detail which might change is incredibly dangerous.
That being said, the PostgreSQL documentation doesn't say anything in particular about the predictability of `gen_random_uuid`, so the behavior is unspecified. But it's worth noting the function has an explicit guard to raise an error if secure random is not available, so they were conscious of this possibility and did not attempt any misguided fallbacks.
And unfortunately this requirement is not baked into the UUID spec either, which uses the word "should" instead of "must" when discussing CSPRNG usage.