Hi Ken
this was not an upgrade, it was a fresh install of moodle on a new server. I had just installed that same version on Windows8.1 without issue, so I didn't understand what was the problem.
At first I didn't make nothing of the upgrade checks being run, but in hindsight, probably that is the cause of the script assuming the table exists. I didn't investigated why this new installation was being regarded as an upgrade, maybe that is the real root of the error.
regards