Topic: PunBB 1.4.1 "post" broken after manual SQL insert into pbb_posts

Hello,

Due to need to import (gate from email) messages, I've tried to perform insert into pbb_posts table with respective id, topic_id, poster, message etc. (found no sequence, so tried id=(select max(id)+1 from ...), then tried 0, -1, 999999 - all with the same result:

This immediately resulted in broken forum:
- first subsequent "Reply" posted by webuser displays an error page, in fact the reply is posted with id=0 (!)
- any further reply not saved at all, as is raises primary key conflict

Removal of all of the manually inserted and "test reply" rows does not fix the issue (!)

I wonder what can it be, and how to correctly insert data in parallel with PunBB normal operation.

-----------------------
first webuser posting raises:
The error occurred on line 151 in /virt/homes/ok-forum.nya.me/htdocs/include/search_idx.php
Database reported: Duplicate entry '0' for key 'PRIMARY' (Errno: 1062).
Failed query: INSERT INTO okf_pbb_search_words (word) VALUES('test'),('reply')

at this moment respective post row already written to pbb_posts with wrong id=0

(subsequent webuser replies obviously raise error on insert to pbb_posts with id=0)
-----------------------

Currently, I've hotfixed it with setting AUTO_INCREMENT on id columns in pbb_posts and pbb_search_words.
(surprise! this keeps pbb_search_match coherent with data inserts)


It would be nice to know more of such a behaviour, and how to handle data inserts correclty from developer's point of view.

Thank you very much in advance.