MDEV-38983 Add uuid_version() to uuid type#4732
Open
lefred wants to merge 6 commits into
Open
Conversation
grooverdan
requested changes
Mar 5, 2026
grooverdan
left a comment
Member
There was a problem hiding this comment.
Welcome @lefred.
Lets get a MDEV written, and some additional strictness with the UUID standards for a UUID_VERSION (which is pretty close to to what user's might expect a UUID_VALID function to perform).
Member
|
And correct Windows compiling error |
grooverdan
requested changes
Mar 13, 2026
grooverdan
requested changes
Mar 25, 2026
grooverdan
left a comment
Member
There was a problem hiding this comment.
Small changes:
- white space change removal from non-changes coded
- remove unnecessary
ifcondition - rebase to main, squash up commits (removing merge commits), include MDEV, describe in detail what this implements. Describe UUIDv2 DCE deprecated in practice and lets see if anyone objects.
- Testing ends with 13.1 now that 13.0 preview is out.
I tested with the following (AI assisted) that aided visualing all the version numbers. I think it helps be clear on coverage, include if you think so too.
CREATE TABLE t1 (id uuid PRIMARY KEY);
INSERT INTO t1 (id) VALUES
-- Version 1 (time-based)
('6ba7b810-9dad-11d1-80b4-00c04fd430c8'),
('f81d4fae-7dec-11d0-a765-00a0c91e6bf6'),
-- Version 3 (MD5 name-based)
('9073926b-929f-31c2-abc9-fad77ae3e8eb'),
-- Version 4 (random)
('550e8400-e29b-41d4-a716-446655440000'),
('123e4567-e89b-42d3-a456-426614174000'),
('ffffffff-ffff-4fff-bfff-ffffffffffff'),
-- Version 5 (SHA-1 name-based)
('2ed6657d-e927-568b-95e1-2665a8aea6a2'),
-- Version 6 (reordered time-based)
('1ec9414c-232a-6b00-b3c8-9e6bdecf3d2a'),
('1f0799c0-98b9-6f10-a2d3-5f6e7c8b9a01'),
-- Version 7 (Unix time + random)
('01890f4e-7b1a-7cc0-9f2a-6b5c4d3e2f10'),
('017f22e2-79b0-7a5b-b123-456789abcdef'),
-- Version 8 (custom / experimental)
('12345678-1234-8abc-8def-1234567890ab'),
('ffffffff-ffff-8fff-bfff-ffffffffffff'),
-- Boundary / edge patterns
('00000000-0000-4000-8000-000000000000'),
('aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa'),
('bbbbbbbb-bbbb-4bbb-bbbb-bbbbbbbbbbbb'),
-- Mixed / fuzz-like
('deadbeef-dead-4bad-8eed-feedfacecafe'),
('cafebabe-cafe-4abe-8afe-babecafebabe');
SELECT id,uuid_version(id) as v FROM t1 ORDER BY id;
TRUNCATE TABLE t1;
-- UUIDv2 - DCE
INSERT INTO t1 (id) VALUES
('000003e8-89ab-21d3-8c4d-001122334455'),
('000007d0-1234-2abc-9def-112233445566'),
('00000064-dead-2bad-a123-abcdefabcdef'),
('0000c350-beef-2345-b678-1234567890ab'),
('00000001-cafe-2ace-8ace-feedfacecafe');
SELECT id,uuid_version(id) as v FROM t1 ORDER BY id;
DROP TABLE t1;
This patch adds a uuid_version() function to the uuid datatype plugin. It validates the uuid and returns the version. Based on practicialites - uuidv2 (DCE) generates a deprecated warnings: Warning 1300 Version 2 UUIDs are deprecated
grooverdan
approved these changes
Mar 25, 2026
vuvova
reviewed
May 29, 2026
| { | ||
| my_printf_error(ER_INVALID_CHARACTER_STRING, | ||
| "Version 2 UUIDs are deprecated", ME_WARNING); | ||
| } |
Member
There was a problem hiding this comment.
no, remove this. UUIDv2 are not deprecated, and even if they were — they are not deprecated in MariaDB
Signed-off-by: Frederic Descamps <lefred@mariadb.org>
and error messages Signed-off-by: Frederic Descamps <lefred@mariadb.org>
Update mtr Add header and change validation function to be used by other functions Signed-off-by: Frederic Descamps <lefredi@mariadb.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch adds uuid_version() function to uuid type