← Back to team overview

maria-discuss team mailing list archive

Re: ALTER TABLE removes check constraint

 

Hi, Peter!

On Nov 22, Peter Laursen wrote:
> OK, I can see it is the same thing happening here
> 
> DROP TABLE tab;
> CREATE TABLE tab( id INT, num INT KEY);
> ALTER TABLE `test`.`tab` CHANGE `num` `num` BIGINT;
> SHOW CREATE TABLE tab;
> /*
> CREATE TABLE `tab` (
>   `id` int(11) DEFAULT NULL,
>   `num` bigint(20) NOT NULL, -- <-- no KEY here anymore
>   PRIMARY KEY (`num`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 */
> 
> However for indexes there is the SHOW INDEX command that will return a lsit
> of all indexes no matter what syntax variant was used to create them.
> Is there something similar for (CHECK) CONSTRAINTS that returns a list of
> all (CHECK) CONSTRAINTs for a table (or a complete database/schema)? I
> don't find anything in Information_Schema anywhere.
> 
> Such 'metadata instrumentation' is extremely important for client
> development.

The standard specifies, that it must be INFORMATION_SCHEMA.CHECK_CONSTRAINTS,
but it's not implemented at the moment :(

I've created https://jira.mariadb.org/browse/MDEV-14474 for it.

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx


References