{"id":11739552,"date":"2019-07-17T10:34:45","date_gmt":"2019-07-17T10:34:45","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/null-values-in-database-queries\/"},"modified":"2019-07-17T10:34:45","modified_gmt":"2019-07-17T10:34:45","slug":"null-values-in-database-queries","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/null-values-in-database-queries\/","title":{"rendered":"NULL values in database queries"},"content":{"rendered":"<p>There seems to be an issue with the migration part of the new 3.0.0 updated. We are seeing this issue across many sites and servers.<\/p>\n<p>When the update happens, it is calling:<\/p>\n<p><code>PrliUtils-&gt;migrate_after_db_upgrade()<\/code><\/p>\n<p>This then calls:<\/p>\n<p><code>$cpt_id = $prli_link-&gt;create_cpt_for_link($link-&gt;name, $link-&gt;created_at, $link-&gt;updated_at);<\/code><\/p>\n<p>The problem is that at least in our examples, every entry in the <code>wp_prli_links<\/code> table has an <code>updated_at<\/code> value of NULL. The <code>create_cpt_for_link<\/code> function then tries to do a direct insert to the <code>wp_posts<\/code> table except the values for <code>post_modified<\/code> and <code>post_modified_gmt<\/code> respectively come out like so:<\/p>\n<p><code>NULL, &#039;1970-01-01 00:00:00&#039;<\/code><\/p>\n<p>This is not allowed by the <code>wp_posts<\/code> table schema:<\/p>\n<p><code>WordPress database error Column &#039;post_modified&#039; cannot be null for query...<\/code><\/p>\n<p>This causes a lot of spam in error logs (in fact we&#8217;ve seen it creating 10+GB of error logs quite easily) and also causes load on the database. It then seems to keep trying every 30 minutes due to the transient you have to retry installations.<\/p>\n<p>A fix for this problem ASAP would be very useful.<\/p>\n","protected":false},"template":"","class_list":["post-11739552","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11739552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11739552\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11739552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}