Hi FMP,
it seems as if you have at least one messed up def file, but that's not a big deal. We're going to fix this in a minute.
Just start your search for the problem at the def file of whatever you tried to delete, e.g. admin/defs/prefix_Users.def if you unsuccessfully tried to delete a user. In the appropriate file you'll find a hash key named 'fk_tables' which points to an anonymous array. This array contains each and every table that relates to at least one column of this table.
Say 'fk_tables' in lsql_Users.def looks like this:
'fk_tables' => [
'lsql_Links',
'lsql_Changes',
'lsql_Reviews',
'lsql_Editors',
'lsql_Sessions'
],
This tells you that the tables 'lsql_Links', 'lsql_Changes', 'lsql_Reviews', 'lsql_Editors' and 'lsql_Sessions' all in some way relate to 'lsql_Users'. Make sure there is no non-existent table in this list. Plugins which don't clean up properly after themselves could cause such a mess.
If the list of tables is ok, start looking into to corresponding def files. For instance, in lsql_Links.def there should be something like:
'fk' => {
'lsql_Users' => {
'LinkOwner' => 'Username'
}
},
This means that the column 'LinkOwner' in 'lsql_Links' relates to the column 'Username' in 'lsql_Users' an is called a foreign key. These foreign keys can be very useful, because if a user is deleted the Links system also automatically deletes all of her links (related to by the foreign key).
So basically you just have to look for some incosistencies in the foreign table and the foreign key declarations, e.g. non-existent tables and non-existent columns clearly indicate problems as do empty foreign key declarations in def files which are listed in foreign table declarations.
Hope that helps to at least get started.
Regards,
Lucas