When I started using Hydrus a while back, I decided to have leading spaces on all the tags in namespaces.
Don't ask.
Now I've decided it's time to stop being an ass and standardize back to namespace:tag instead of namespace: tag. I don't know much Mysql, but after some brief reading the solution seemed obvious enough: Head over to client.master.db (after backup) and run "UPDATE tags SET tag = LTRIM(tag)." Except:
"Error while executing query: column tag is not unique"
Oops.
Turns out I'm not just a moron, but a sloppy moron. In 94 cases the whitespaced tag already exists as a regular tag, so I can't cut off the whitespace or the resulting tag won't be unique. Hey, no problem I thought, I'll just re-map those 94 regular tags to spaced tags in Hydrus and then delete them in the db since they're not mapped to anything. Unfortunately Hydrus (understandably) can't handle tags going missing from the db, even if they're no longer in use, and there's no clean way to delete them that I can see.
So I'm at a loss. I have roughly 1600 whitespaced tags to fix. Any thoughts on the best way to attack this?