Menu

#749 [MariaDB] Import of export made by Adminer fails on setting SQL_MODE

Git
closed-fixed
nobody
None
5
2021-02-06
2020-05-01
Thomas
No

Environment:
Adminer 4.7.6
Apache 2.4.39
MariaDB 10.3.21
PHP 7.3.11

When the MariaDB variable SQL_MODE contains the ANSI_MODE flag, importing a database that was exported on the same environment halts on a error #1064. The export procedure followed the quoting style of the database, but the import procedure is not performed with the same quotation style, so the syntax error is given on the double quotes used for fieldnames.

The backup .sql created by Adminer starts by setting some variables and contains the following line:
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

The SQL_MODE is a comma separated list and could contain multiple values, the previous statement bluntly resets it to a single value: "NO_AUTO_VALUE_ON_ZERO". Thus eliminating the ANSI_QUOTE setting that is required for a successful import.

Discussion

  • Thomas

    Thomas - 2020-05-01

    Possible fix: SET sql_mode = CONCAT(@@SQL_MODE, ',NO_AUTO_VALUE_ON_ZERO');

    More info: https://mariadb.com/kb/en/sql-mode/

     
  • Jakub Vrána

    Jakub Vrána - 2021-02-06
    • status: open --> closed-fixed
     
  • Jakub Vrána

    Jakub Vrána - 2021-02-06

    I've decided to reset sql_mode before export to be importable elsewhere.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.