Comments - CHECK constraint introduced, when make it really useful?

5 years, 9 months ago Jan-Hendrik Diederich

Simple Example which makes sure there are no entries inserted or updated which have overlapping time spans. Most important: This solution should be thread safe: CREATE TABLE Test ( startTime bigint(20), stopTime bigint(20), CONSTRAINT overlapping CHECK ( (SELECT COUNT(*) FROM Test r WHERE r.startTime < stopTime AND r.endTime > startTime LIMIT 1) = 0 ) ); Even more elegant would it be to put the CHECK content into a function. But I consider that to be a luxury.

 
5 years, 9 months ago Ian Gilfillan

I suggest adding this as a feature request on JIRA, especially if it's valid on another DBMS.

 
5 years, 9 months ago Jan-Hendrik Diederich

Sorry, my bad. What I was looking for where ASSERTIONS, and they are nearly implemented by nobody.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.