This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Problem with ALTER TABLE and ADD CONSTRAINT

My MariaDB version id 10.5.9, running on Manjaro Nibia (20.2.1).

I am trying to add a CHECK constraint to an existing field. This is my statement, modelled on the syntax at https://mariadb.com/kb/en/constraint/

ALTER TABLE sources ADD CONSTRAINT chk_under1000 CHECK (source_dances < 1000);

I get the following error: "A new statement was found, but no delimiter between it and the previous one. (near CHECK)". I get this error irrespective of whether I use backtick field delimiters or not. phpMyAdmin also flags up CHECK as an error.

What am I doing wrong, please?

Michael Barraclough

Answer Answered by Ian Gilfillan in this comment.

This appears to be a phpMyAdmin error (and the issue has been an open bug since 2017), so I suggest using an alternative client.

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.