By Basil Bourque

2017-06-28 04:12:54 8 Comments

The source code for pg_crypto module mentions an option to build without cryptographically-strong random generation.


  • Generate random bits. pg_backend_random() will do here, we don't promis

  • UUIDs to be cryptographically random, when built with

  • --disable-strong-random.


Discussed further in this thread.

In the particular build I may be using, how can I detect if the strong random feature is enable or disabled?


@Basil Bourque 2017-06-30 05:23:27

configure fails

At least as of Postgres 10 beta, you can look for configure to fail. If you have not given permission for the strong-random to be omitted (via a configure setting), then Postgres built without strong-random will fail during configure.

To quote the 10 beta doc:

• Add more robust random number generators to be used for cryptographic secure uses (Magnus Hagander, Michael Paquier, Heikki Linnakangas)

If no strong random number generator can be found, configure will fail unless the configure --disable-strong-random is used. However, with this option, pgcrypto functions requiring a strong random number generator will be disabled.

@Kassandry 2017-06-29 05:28:41

--disable-strong-random is a PostgreSQL configuration option available in the ./configure script in the source code. You could check to see if your version of PostgreSQL and the associated contrib modules were built with it by using pg_config --configure and looking to see if that particular flag was passed in as part of the config process. Though as it says in the thread that was linked, no reasonable production platform would use that flag, so odds are that you've got a cryptographically random build.

Related Questions

Sponsored Content

1 Answered Questions

3 Answered Questions

[SOLVED] PSQL: create random data sets with the same statistic distrbution as another table

  • 2018-12-16 13:32:47
  • Darth Kangooroo
  • 57 View
  • 1 Score
  • 3 Answer
  • Tags:   postgresql random

1 Answered Questions

2 Answered Questions

[SOLVED] fill table A with random ID's from another table B

  • 2015-10-25 14:31:44
  • H. Pauwelyn
  • 4541 View
  • 2 Score
  • 2 Answer
  • Tags:   sql-server random

1 Answered Questions

[SOLVED] mysql - select random rows with max 3 rows per parent id

1 Answered Questions

[SOLVED] Result occurs often with fast random select query

2 Answered Questions

[SOLVED] Perform group by with random group expression (randomly partitioning rows) MYSQL

  • 2014-07-18 22:52:56
  • seanv507
  • 1036 View
  • 1 Score
  • 2 Answer
  • Tags:   mysql random

2 Answered Questions

[SOLVED] Postgres client unable to detect UTF-8 database

2 Answered Questions

[SOLVED] How to create column in DB with default value random string

Sponsored Content