Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Invalid SQL syntax while creating tables using MySQL database #1127

@flesniak

Description

@flesniak

Problem description

When creating a new database using a MariaDB server, airsonic tries to use VARCHAR without a length which is invalid syntax for MySQL. This error is printed:

```ERROR --- liquibase.changelog.ChangeSet: Change Set classpath:liquibase/legacy/schema25.xml::schema25_003::muff1nman failed.  Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL, CONSTRAINT PK_ROLE PRIMARY KEY (id))' at line 1 [Failed SQL: CREATE TABLE airsonic.`role` (id INT AUTO_INCREMENT NOT NULL, name VARCHAR NOT NULL, CONSTRAINT PK_ROLE PRIMARY KEY (id))]```

It seems like liquibase does not use the varchar_type for mysql, as set here: https://github.com/airsonic/airsonic/blob/master/airsonic-main/src/main/resources/liquibase/db-changelog.xml
The query works if I change VARCHAR to VARCHAR(255) and execute it manually.

Steps to reproduce

  1. Configure a fresh airsonic installation to use a mysql server via jdbc like shown below
  2. Start the server

System information

  • Airsonic version: 10.3.1
  • Operating system: Arch Linux
  • Java version: Java: 1.8.0_212 (jre8-openjdk 8.u212-1)
  • SQL server: mysqld Ver 10.3.15-MariaDB

Additional notes

DatabaseMysqlMaxlength=255
DatabaseConfigType=EMBED
DatabaseConfigEmbedDriver=com.mysql.jdbc.Driver
DatabaseConfigEmbedPassword=password
DatabaseConfigEmbedUrl=jdbc:mysql://localhost:3306/airsonic
DatabaseConfigEmbedUsername=airsonic
DatabaseUsertableQuote=

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: UNKNOWN-backendThe problem location has not been identified yet.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions