Repository navigation
Support MariaDB UUID type #3401
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
What do you want to change?
MariaDB has some extensions over standard MySQL, most notably a UUID type, which currently leads to:
internal/datastore/mysql/migrations/schema.sql:4:44: syntax error near "uuid NOT NULL DEFAULT (uuid()), `uploaded` datetime NOT NULL DEFAULT (current_timestamp()), `owner` int NOT NULL, PRIMARY KEY (`id`), INDEX `owner` (`owner`), CONSTRAINT `owner` FOREIGN KEY (`owner`) REFERENCES `irori`.`organisations` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;"
It would be nice to have it supported.
The schema:
-- Create "organisations" table
CREATE TABLE `irori`.`organisations` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `description` varchar(255) NOT NULL, PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "documents" table
CREATE TABLE `irori`.`documents` (`id` uuid NOT NULL DEFAULT (uuid()), `uploaded` datetime NOT NULL DEFAULT (current_timestamp()), `owner` int NOT NULL, PRIMARY KEY (`id`), INDEX `owner` (`owner`), CONSTRAINT `owner` FOREIGN KEY (`owner`) REFERENCES `irori`.`organisations` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "user" table
CREATE TABLE `irori`.`user` (`id` int NOT NULL AUTO_INCREMENT, `name` varchar(64) NOT NULL, `token_sub` varchar(128) NOT NULL, PRIMARY KEY (`id`)) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
-- Create "user_organisations" table
CREATE TABLE `irori`.`user_organisations` (`user` int NOT NULL, `organisation` int NOT NULL, `permissions` int NOT NULL, INDEX `organisation` (`organisation`), INDEX `user` (`user`), CONSTRAINT `organisation` FOREIGN KEY (`organisation`) REFERENCES `irori`.`organisations` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT `user` FOREIGN KEY (`user`) REFERENCES `irori`.`user` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION) CHARSET utf8mb4 COLLATE utf8mb4_general_ci;What database engines need to be changed?
MySQL
What programming language backends need to be changed?
Go
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
[-]Support MariaDB[/-][+]Support MariaDB UUID type[/+]mpldr commentedon May 27, 2024
Since this is in a sense an extension to MySQL, this should probably be accompanied by a warning about this type not being available in all server implementations.
mpldr commentedon May 30, 2024
Okay, I've taken a look, and it seems to be something for
github.com/pingcap/tidb's parser, which would probably involve a lot of convincing. Any idea on how to do it better?leofleeo commentedon Apr 15, 2026
The mysql driver already has full support for mariadb, and UUID support was merged into into tidb with pingcap/tidb#65007
Support MariaDB UUID column type
kyleconroy commentedon Apr 19, 2026
The latest TiDB parser still does not recognize MariaDB's uuid column type, even with SetMariaDB(true). pingcap/tidb#65007 added UUID functions (UUID_V4, UUID_V7, UUID_VERSION, UUID_TIMESTAMP) but not the column type.