UUID Data Type

MariaDB starting with 10.7.0

The UUID data type was added in a MariaDB 10.7.0 preview.

Syntax

UUID

Description

The UUID data type is intended for the storage of UUID data.

Retrieval

Data retrieved by this data type is in the string representation defined in RFC4122.

Casting

String literals of hexadecimal characters and CHAR/VARCHAR/TEXT can be cast to the UUID data type. Likewise hexadecimal literals, binary-literals, and BINARY/VARBINARY/BLOB types can also be cast to UUID.

Examples

CREATE TABLE t1 (id UUID);

Inserting via string literals:

INSERT INTO t1 VALUES('123e4567-e89b-12d3-a456-426655440000');

Inserting via hexadecimal literals:

INSERT INTO t1 VALUES (x'fffffffffffffffffffffffffffffffe');

Retrieval:

select * from t1;
+--------------------------------------+
| id                                   |
+--------------------------------------+
| 123e4567-e89b-12d3-a456-426655440000 |
| ffffffff-ffff-ffff-ffff-fffffffffffe |
+--------------------------------------+

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.