debian-start: SQL Syntax Error with Table Name Containing Hyphen

Bug #2085554 reported by Ubuntu User
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mariadb (Ubuntu)
Fix Released
Medium
Otto Kekäläinen

Bug Description

Ubuntu 24.04.1 LTS
mariadb-server 10.11.8

Dear Maintainer,

When attempting to run the Debian start script (/etc/mysql/debian-start) for MariaDB, a SQL syntax error occurs when using a MyISAM table with a hyphen in the name. The table name "test-123" triggers the error "ERROR 1064 (42000)":

Oct 24 16:14:53 ubuntu /etc/mysql/debian-start[1621539]: WARNING: mariadb-check has found corrupt tables
Oct 24 16:14:53 ubuntu /etc/mysql/debian-start[1621539]: ERROR 1064 (42000) at line 1: 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 '-123' at line 1

There is a bug in the script /usr/share/mysql/debian-start.inc.sh:

SELECT CONCAT("select count(*) into @discard from '\''", TABLE_SCHEMA, "'\''.'\''", TABLE_NAME, "'\''")

The SQL command fails because the table name is not enclosed in backticks. Under Ubuntu 22.04 with MariaDB 10.6.18 the corresponding line is correct and contains the necessary backticks:

select concat('\''select count(*) into @discard from `'\'', TABLE_SCHEMA, '\''`.`'\'', TABLE_NAME, '\''`'\'')

Best regards

CVE References

Revision history for this message
Otto Kekäläinen (otto) wrote :

Thanks for the bug report!

In the spirit of open source, would you like to submit your fix as a Merge Request at https://salsa.debian.org/mariadb-team/mariadb-server?

This improvement should go into Debian unstable first, and if there are no regressions, it can be backported to Ubuntu 24.04.

Changed in mariadb (Ubuntu):
status: New → Confirmed
Revision history for this message
Joe Bliss (blissjoe) wrote :

Hi,

We started having the same problem migrating our application to a new server. I submitted a Merge Request for this.

https://salsa.debian.org/mariadb-team/mariadb-server/-/merge_requests/103

Thank you,

Joe

Otto Kekäläinen (otto)
Changed in mariadb (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Otto Kekäläinen (otto)
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mariadb - 1:11.4.5-1

---------------
mariadb (1:11.4.5-1) unstable; urgency=medium

  [ Otto Kekäläinen ]
  * New upstream version 11.4.5. Includes fixes for several defects
    as noted at https://mariadb.com/kb/en/mariadb-11-4-5-release-notes/ as well
    the following security issues:
    - CVE-2025-21490
  * Include new packaging changes done upstream:
    - MDEV-35907: debian-start script fails when using non-standard socket path
    - MCOL-5819: Disable LTO for ColumnStore, otherwise enabled by default
    - MDEV-32686: Include ELF package notes
  * Update configuration traces to match changes done in MDEV-35785
  * Update configuration traces with new query allocator values from MDEV-35750
  * Build MariaDB RocksDB on loong64 now too
  * Fix minor typos in Debian packaging files
  * Fix broken links in d/copyright
  * Unify spelling fix patches into one, and fix spelling of Enrypt->Encrypt

  [ Matthew Vernon ]
  * Add patch to fix `main.func_regexp_pcre` failing with latest PCRE2 10.45
    due to backwards-incompatible case-sensitivity change in behavior in latest
    PCRE2 version (Closes: #1095286)

  [ Joe Bliss ]
  * Revert backticks change in commit 0300a915 to be compatible with databases
    containing hyphenated table names (LP: #2085554)

 -- Otto Kekäläinen <email address hidden> Wed, 19 Feb 2025 08:57:57 -0800

Changed in mariadb (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Otto Kekäläinen (otto) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.