[MDEV-26073] Check-Constraint works on Windows 10 Pro x64 with MariaDB 10.4.12, but not on Debian 9 (backports kernel) on version 10.1.48-MariaDB-0+deb9u2 Created: 2021-07-01  Updated: 2021-07-17  Resolved: 2021-07-17

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Insert, Data Manipulation - Update
Affects Version/s: 10.1.48
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Hans Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: CONSTRAINT, check, check_constraints
Environment:

As described in the title....



 Description   

Code here:

SET SQL_NOTES = 0;
 
CREATE DATABASE IF NOT EXISTS `pf_server`;
USE `pf_server`;
DROP TABLE IF EXISTS `clientdb_mapping`;
 
CREATE TABLE IF NOT EXISTS `clientdb_mapping` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `expected_hash` varchar(60) DEFAULT NULL,
  `identify_hash` varchar(60) DEFAULT NULL,
  CHECK (
    CASE
      WHEN expected_hash IS NULL THEN identify_hash IS NULL
    END
  ),
  CHECK (
    CASE
      WHEN expected_hash IS NOT NULL
        AND identify_hash IS NOT NULL THEN expected_hash = identify_hash
    END
  ),
  `db_name` varchar(100) NOT NULL,
  `db_version` varchar(25) NOT NULL DEFAULT '1.1.1',
  `allnodes` int(11) NOT NULL DEFAULT '9999',
  `licensedate` date NOT NULL DEFAULT '2099-01-01',
  `licensedatenodes` date NOT NULL DEFAULT '2099-01-01',
  `timestamp` datetime DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `identify_hash` (`identify_hash`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
 
SET SQL_NOTES = 1;



 Comments   
Comment by Hans [ 2021-07-01 ]

If there are any questions, so please don't heisitate to ask me. Thank you very much.

Comment by Hans [ 2021-07-02 ]

Is there a workaround to bypass that issue?? Thx for feedback!

Comment by Sergei Golubchik [ 2021-07-17 ]

https://mariadb.com/kb/en/create-table/#constraint-expressions

Note: Before MariaDB 10.2.1, constraint expressions were accepted in the syntax but ignored.

Generated at Thu Feb 08 09:42:32 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.