Skip to content

No support for default collation (utf8mb4_uca1400_ai_ci) in MariaDB #4222

@wouthoekstra

Description

@wouthoekstra

Version

1.30.0

What happened?

When I run sqlc generate in my project, I get this output:

# package sqlc
sql/schema.sql:1:1: [ddl:1273]Unknown collation: 'utf8mb4_uca1400_ai_ci'"

I am unsure if this considered is a bug or a feature, but according to the mariadb documentation utf8mb4_uca1400_ai_ci is now the default collation:
https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets/character-set-and-collation-overview

I am aware that the project does not specifically mention support for MariaDB. Since the project is so close to MySQL I hope this still is considered as a fixable bug.

For reproduction purposes, this is one of my tables (simplified a bit) in my schema that triggers this error:

CREATE TABLE `user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `created_at` datetime NOT NULL DEFAULT current_timestamp(),
  `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp(),
  `username` varchar(255) NOT NULL DEFAULT '',
  `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `user_username_unique` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;

Relevant log output

Database schema

SQL queries

Configuration

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

No response

What type of code are you generating?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions