## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> GEN_RANDOM_UUID[GEN_RANDOM_UUID]:::quoted GEN_RANDOM_UUID --> End((END)) ``` ## Purpose The `GEN_RANDOM_UUID` SQL function creates a new random UUID of version 4. It is another name for [[NEWID]] and the same function as [[UUIDV4]], under the name PostgreSQL has used since version 13. Available from release 28.0. See also [[UUIDV7]], [[UUID_EXTRACT_VERSION]] and [[NEWID]]. Returns: the new UUID, of data type `guid`. Each call creates a UUID of its own. ## Examples The following example creates a new random UUID and reads its version: ```sql select uuid_extract_version(gen_random_uuid()) version ------- 4 ```