vB -> xF 'threadid' doesn't exist in table 'post'

Race Sim Central

New member
Affected version
1.5.2 importers latest xf
Can anyone help? I am importing a vBulletin forum to xenForo on the same mysql server.

  • XF\Db\InvalidQueryException: MySQL statement prepare error [1176]: Key 'threadid' doesn't exist in table 'post'
  • src/XF/Db/AbstractStatement.php:230

SELECT post.*,
IF(user.username IS NULL, post.username, user.username) AS username,
thread.title AS threadtitle,
editlog.dateline AS editdate,
editlog.userid AS edituserid,
deletionlog.userid AS deleteuserid,
deletionlog.username AS deleteusername,
deletionlog.reason AS deletereason,
deletionlog.dateline AS deletedate
FROM post AS
post USE INDEX (threadid)
thread ON (post.threadid = thread.threadid)
user ON (user.userid = post.userid)
LEFT JOIN editlog AS
editlog ON (editlog.postid = post.postid)
LEFT JOIN deletionlog AS
deletionlog ON (deletionlog.primaryid = post.postid AND deletionlog.type = 'post')
WHERE post.threadid = ?
AND post.dateline > ?
ORDER BY post.dateline, post.postid


#0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 1176, '42000')
#1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1176, '42000')
#2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
#3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
#4 src/XF/Db/AbstractAdapter.php(157): XF\Db\AbstractAdapter->query('
SELECT post...', Array)
#5 src/addons/XFI/Import/Importer/vBulletin.php(3148): XF\Db\AbstractAdapter->fetchAll('
SELECT post...', Array)
#6 src/XF/Import/Importer/StepPostsTrait.php(105): XFI\Import\Importer\vBulletin->getPostsForPostsStep(7, 0)
#7 src/XF/Import/Runner.php(244): XFI\Import\Importer\vBulletin->stepPosts(Object(XF\Import\StepState), Array, 8)
#8 src/XF/Import/Runner.php(61): XF\Import\Runner->runStep('posts', Object(XF\Import\StepState), 8)
#9 src/XF/Admin/Controller/Import.php(234): XF\Import\Runner->run()
#10 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Import->actionRun(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Import', 'Run', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#12 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Import), NULL)
#13 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#14 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
#15 src/XF.php(524): XF\App->run()
#16 admin.php(13): XF::runApp('XF\\Admin\\App')
#17 {main}
It looks like invalid data in the VB database.

If you can identify the thread the post is from, you can likely change the ID and then do the import again.

If you can't, attach it to an existing thread then delete the post using the regular mod tools - that will ensure everything is updated correctly.
It looks like it's dead. There's no information in that row that would indicate what it was supposed to be. After 6 days of importing threads this is pretty devastating to have to think about restarting or repairing. Is there really no way to just skip the problem post?
You can try deleting the post in VB and resuming the importer.
It may work.

Why has it taken 6 days to import threads?
Even for very large forums it should only be a matter of hours with the right server set up.
So yeah, I've been through. Every thread in the temporary xf import tables exists in the original vb post table with posts assigned to that threadid. I don't see that there would be anything wrong with that data. Are we sure that error is about data and that for some reason it can't find the entire column?
I had to index the threadid in structure. So it was the KEY part of the error that was telling us what was wrong. Hope this helps someone else in the future.

I had to go to the post table, view structure, select the threadid row and index it. A key appeared beside it.

This was probably caused by the fact I had to split up the sql export of the database so I could not import certain things and I neglected to include something that would have properly set this for me.
Top Bottom