I decided to use the trigger in the trigger
SET next_id = (SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='tname');
did not work. The phpMyAdmin was able to find out the following:
select database()
returns the name of the databaseselect * from information_schema.tables where TABLE_SCHEMA=имя_базы
works correctlyselect * from information_schema.tables where TABLE_SCHEMA=database()
returns fields withTABLE_SCHEMA
equalinformation_schema
MySql 5.5, if that
What am I doing wrong?
TABLE_NAME='tname'
selects exactly one entry. And it’s very interesting why the trigger might need such a construction. For getting an id not through get_last_id () will lead to potential problems. - Mike