The error was pretty simple and dumb: there were soome triggers pointing to that other database and I did not know they were there, until I started checking table by table. I disabled them all and it worked, so always check those kind of things.