We might also consider wrapping table names in sqls in upgrade scripts into "{" and "}" this way we can see where table name is in the sql and manipulate with it.
For example INSERT INTO table1 SELECT FROM table2; query doesn't work, because table2 isn't recognized in the sql and TABLE_PREFIX (e.g. "inp_") isn't added to it.
To solve this we add <%TABLE_PREFIX%> in front of such tables.
Replacing that sql with following: INSERT INTO {table1} SELECT FROM {table2}; we can quickly add necessary changes to table names. For example we had problems with direct upgrade from 5.0.0 to 5.2.0 because table names in upgrade scripts became outdated. With {} scheme we then could have always replaced older table names into newer table names on the go.
Let's don't forget about INSERT into AdminSkins table, where CSS exists with {....} in it too. I think we can do some workaround about it too.