## Syntax ```mermaid %%{init: { 'theme': 'base', 'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' }, 'themeVariables': { 'fontSize': '11px', 'fontFamily': 'Arial' } }}%% flowchart LR Start((START)) --> UUID_GENERATE_V5[UUID_GENERATE_V5]:::quoted UUID_GENERATE_V5 --> End((END)) ``` ## Purpose The `UUID_GENERATE_V5` SQL function creates the name-based UUID of version 5 (RFC 9562) of a name in a namespace, using SHA-1. A name-based UUID is always the same for the same namespace and name, so it can serve as a stable ID derived from a natural key. The hash only spreads the names; it protects nothing, so do not use it to hide the name. The function has the name and the arguments of the function of the `uuid-ossp` extension of PostgreSQL. Available from release 28.0. See also [[UUID_GENERATE_V3]], [[UUID_NS_DNS]], [[UUID_NS_URL]], [[UUID_NS_OID]] and [[UUID_NS_X500]]. Parameters: - Namespace (`guid`): the namespace, such as `uuid_ns_dns()`, or the text of a UUID. - Name (`varchar2`): the name, taken as UTF-8. The result is `null` when the namespace or the name is `null`. Text which is no UUID as the namespace raises `itgenduy005`. Returns: the UUID, of data type `guid`. ## Examples The following example creates the UUID of the name `python.org` in the namespace of domain names: ```sql select uuid_generate_v5(uuid_ns_dns(), 'python.org') ------------------------------------ 886313e1-3b8a-5372-9b90-0c9aee199e5d ``` The following example does the same with the namespace written as text: ```sql select uuid_generate_v5('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'www.example.com') ------------------------------------ 2ed6657d-e927-568b-95e1-2665a8aea6a2 ```