Re: pgcrypto.gen_random_uuid() or uuid-ossp.uuid_generate_v4()?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: pgcrypto.gen_random_uuid() or uuid-ossp.uuid_generate_v4()?
Date: 2018-02-06 14:56:44
Message-ID: 29828.1517929004@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thiemo Kellner <thiemo(at)gelassene-pferde(dot)biz> writes:
> I consider using uuid as primary key type. The documentation of
> uuid-ossp states
> (https://www.postgresql.org/docs/10/static/uuid-ossp.html#idm46428633607040)
> makes a note to consider the pgcrypto function instead but not why.
> Can somebody shed some light on that matter?

I believe the point of the recommendation is that if you only need type-4
UUIDs, you can get that from pgcrypto without needing the external
dependency of the OSSP UUID library. This is a bit less urgent than when
that text was written, because now we also support building that contrib
module against some other implementations; but there are still going to
be systems on which installing uuid-ossp is inconvenient.

There may also be a belief that pgcrypto's result is more
cryptographically secure, though I wouldn't swear to that.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thiemo Kellner, NHC Barhufpflege 2018-02-06 15:22:20 Re: pgcrypto.gen_random_uuid() or uuid-ossp.uuid_generate_v4()?
Previous Message Thiemo Kellner, NHC Barhufpflege 2018-02-06 14:21:54 Re: pgcrypto.gen_random_uuid() or uuid-ossp.uuid_generate_v4()?