Via phpmyadmin I dropped the column 'tidbitz' from a table.
Now any time I try to write to that table I get this error. The column is gone and it's not included in any of the queries that I am running. I know the syntax is correct for my queries. I can't even edit data using phpmyadmin, I still get this error.
I have tried: restarting the mysql server, restarting apache, defragmenting and optimizing the table...
Why is this ghost column sticking around?
Just encountered the same problem. In my case it was caused by an insert trigger that was running a query which was using the no-longer-existing column.
I ended up fixing my problem by creating another identical table, writing all of the data from table one to table two, dropping table one, and renaming table two to table one.
So, the problem is fixed, but I'm still curious to know if anyone has encountered this before and what the root cause is.
Thanks!
Related
Not sure what is going on here, or I'm just going blind from working on the same project for so long... So here's the question.... Something extremely simple..
DB: Maria 10.4.24
PHP: 8.1.6
If I run this query in DBeaver or PHPMyAdmin or PHP
DELETE FROM gps WHERE gp_id = 5
I get
SQL Error [1054] [42S22]: (conn=71) Unknown column 'gp_id' in 'field list'
This just stopped working, it was working, but just stopped....
If I rename the column to bob_id and run DELETE FROM gps WHERE bob_id = 5; it works...
Any ideas?
ANSWER
Instead of just dropping the DB, I deleted all the tables bar the one in question (gps), then tried a delete, it still failed, same error "column not found".
So I went looking for triggers, constraints etc and from somewhere a trigger not known to me got created. This was trying to null the gp_id column in some other table that doesn't have that column in it.
I have foreign key relationship constraints in place to handle this via cascade on delete set to null, I think it must have been DBSchema's doing, it does weird things sometimes.
Dropped the trigger, re-build db and seeded it and all is well in the world once again...
So just an error message with not enough information to point me in the right direction.
I was trying to drop a column of my table but I got an error message.
After a few attempts, suddenly the table disappeared, but I have never dropped it.
I was in the page "table structure" of phpmyadmin, I clicked "drop column" and an error message appeared, which told me "table doesn't exist".
This proves that I dind't drop it, because if I was working in the page table structure of the table it means that the table was there.
And I don't know what happened, seems totally irrational to me.
The table simply disappeared (autodropped) while I was working on it.
However, doesn't matter so much what happened. The question is: how can I restore the table? Given the fact that I didn't drop the table, maybe the table is still somewhere?
It's possible that the table was dropped and an error occured after the table got dropped. Double triple check in PHPMyAdmin, but I think your table has gone forever.
To prevent this happening in the future, always run daily backups on your site and store them in a location that's not on the server hosting your database.
I am running a simple update statement:
UPDATE sometab
SET `somefield1` = '19',
`somefield2` = '3734941'
WHERE somefield3 = '1234';
and I am getting the error:
ERROR 1146 (42S02): Table 'prod._sometab_new' doesn't exist
I can successfully select from the table where somefield3 is 1234.
Why am I getting a table doesn't exist error for a table that exists? And why does the error message refer to a different table? I don't see any triggers associated with the table.
Additional information: A colleague just noticed that it is referring to a prod scheme, but the statement is running in a dev schema built from prod. The update statement works in DBs that were built a few days ago using the same method, but all of the DBs built after some, as of yet, unknown time exhibit the error.
The current theory is that a conversion script to move us to UTF-8 is currently running and creating tables like _ORIG_new as part of its conversion. We are going to wait for the conversion script to finish and then rebuild the dev databases and see if the error still persists.
Does this happen if you also try Insert into or Delete statements ?
Insert INTO sometab(somefield1, somefield2) VALUES (a, b).
If that works you should not have problems probably, otherwise you have problems accessing your database.
Second, are you sure you are using the correct database file and that are you connected to it properly. If you are using it in external application (c#), check your connection strings.
Also check how are you executing the query. I cant think of other more specific solution to your problem
In mysqlworkbench, I created a view, committed it to the database, but I no longer needed it.
As such, I deleted the view in mysql workbench and then updated the database.
I thought all was fine, however in phpmyadmin, it says that the table still exists. What's more, it is constantly in use.
I tried to drop the table within phpmyadmin, however when I try to drop the table, it provides an error message saying:
1051 - Unknown table ... indicating to me that the table is not there.
but it still remains showing in the database, and under collation, it says that the table is 'in use'.
Any advice here?
Problem solved.
It appears as though you cannot delete a view from the database by normal means. The following solved the problem for me.
DROP VIEW IF EXISTS viewName;
I was adding an index on a column and the server timed out. Now all other tables in the database work fine, but I am unable to access the table I was adding an index on. It does not allow me to delete its contents or the table. It just hangs while running the queries and nothing happens.
Any ideas on a possible solution?
MySQL 5.1
Try the REPAIR TABLE command. Details at http://dev.mysql.com/doc/refman/5.1/en/repair-table.html