But does it display the error message? It should, since that's why there's a comment in your code already. So someone at some point agreed with me, but I guess you're only wanting to make essential changes now.Like I said, it all works fine for me, including switching between storage types.
That code (and comment) dates from 12 years ago, I'm not about to go changing it now.
The data should be deleted from the table once you press "Finalize" on the moving files from the database to the file system. If the data still exists when you try to move it back, the issue is with the finalize step. Make sure the user has delete permission on the database (though I imagine there would have been other problems first.)
Are you using any kind of master/slave database? Maybe they need time to synchronize.
$db->query_write(" UPDATE " . TABLE_PREFIX . "filedata SET filedata = '', thumbnail = '' WHERE filedataid IN (" . implode(",", $attachmentids) . ") ");
2. If you move attachments from the file system to the database then the files are deleted from the file system.
At no point should the filedata table have rows removed while the storage type is being changed.
So the only issue here is that the message displayed doesn't reflect what's actually going on. It's not a major issue, but because it said that there's an "error" I had to check that everything did get relocated correctly.