{"id":18617896,"date":"2025-08-28T15:28:55","date_gmt":"2025-08-28T15:28:55","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/sql-error-59\/"},"modified":"2025-08-28T15:28:55","modified_gmt":"2025-08-28T15:28:55","slug":"sql-error-59","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/sql-error-59\/","title":{"rendered":"Sql error"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When activating WP-Polls, I noticed an SQL error in the logs:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>WordPress database error Invalid default value for 'pollq_id' for query ALTER TABLE wp_pollsq ALTER COLUMN <code>pollq_id<\/code> SET DEFAULT ''<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The issue is that the plugin tries to set <code>DEFAULT ''<\/code> on an <code>AUTO_INCREMENT<\/code> column.<br \/>However, in MySQL\/MariaDB, an AUTO_INCREMENT column cannot have a default value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The correct definition should be:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>pollq_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">without a DEFAULT.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This does not break functionality if the tables are already created correctly, but it clutters the error logs and may block installation on some environments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please consider fixing this in a future release.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Best regards,<\/p>\n","protected":false},"template":"","class_list":["post-18617896","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/18617896","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\/18617896\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=18617896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}