UUIDV4
Sintassi
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> UUIDV4[UUIDV4]:::quoted
UUIDV4 --> End((END))
Scopo
La funzione SQL UUIDV4 crea un nuovo UUID casuale di versione 4. È un altro nome per NEWID ed è la stessa funzione di GEN_RANDOM_UUID, con il nome che le attribuisce PostgreSQL 18.
Disponibile a partire dalla versione 28.0.
Vedi anche UUIDV7, UUID_EXTRACT_VERSION e NEWID.
Restituisce: il nuovo UUID, di tipo dati guid. Ogni chiamata genera un UUID univoco.
Esempi
L'esempio seguente crea un nuovo UUID casuale e ne legge la versione:
select uuid_extract_version(uuidv4()) version
-------
4