Skip to content
masterclass Buddy

PostgreSQL · Function

gen_random_uuid

gen_random_uuid() generates and returns a version 4 UUID using random data. It takes no parameters.

Last updated

Syntax

gen_random_uuid ( ) → uuid

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • uuidv4
  • uuidv7
  • uuid_extract_version
  • uuid_extract_timestamp
  • uuid-ossp

Source: PostgreSQL: Documentation: 18: 9.14. UUID Functions. Checked 2026-11-03.