Reputation: 176
In a MariaDB data base I've set up I cannot change tables with foreign keys at all. Querys involving alter table
and drop table
never finish, I don't even get an error message. Same with repair table
.
All I can do is hit ctrl+c. There are no apparent errors indicated in the InnoDB monitor output.
I'm quite new to relational data bases, so it's probably a user error. I just can't see what it might be. Any help greatly appreciated!
foreign_key_checks
to off
The table with the foreign key looks like below. participant_id
is the foreign key.
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
trial_id | smallint(6) | NO | PRI | NULL | |
begin_trial | datetime | NO | UNI | NULL | |
participant_id | tinyint(4) | NO | MUL | NULL |
The referenced table looks like this, id
is participant_id
.
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | tinyint(4) | NO | PRI | NULL | auto_increment |
code | char(6) | NO | UNI | NULL | |
day | date | NO | 0000-00-00 |
Upvotes: 0
Views: 72
Reputation: 176
Yes, user error. I had two connections open, one using the MariaDB client, another one using the VSC plugin. Thus there must have been some kind of lock on write operationsm but not on read operations.
Thanks for being my rubber duck, Stackoverflow.
Upvotes: 0