This Paul.
We do not advise running queries of that nature directly on the database.
That cracks me up. Whatever happened to actually looking at the site and investigating a customer’s problem?
——
The problem is that exp_category_posts had rows in the table with an entry_id of 0. The Publish library has a bug in it, where if there are no default categories and no POST data coming in, it looks for categories in the database for the entry. This still happens for new entries, and it looks for an entry_id of 0. Naturally, this causes new entries on this client’s site to have categories selected by default, based on the ones in exp_category_post with an entry_id of 0.
Now, I looked at this client’s DB backup prior to the EE 1.x to EE 2.x upgrade. exp_category_posts has no rows where entry_id equals 0. So, at some point during the upgrade, those rows seem to have gotten added. Not sure if this is the EL upgrade script or another upgrade script.
I have fixed this client’s site by removing those exp_category_posts rows. I will file a bug report for the Publish library. As for the cause of the exp_category_posts, I leave that up to your developers.