Page MenuHomePhabricator

Error: 1364 Field 'feature' doesn't have a default value
Closed, ResolvedPublic

Description

Spotted in the jobqueue logs:

2018-06-21 14:24:14 updateBetaFeaturesUserCounts Special:MainPage prefs=["advancedsearch"] requestId=81adeb01fc1a2222a0c4b9fa (id=376987,timestamp=20180614122132) STARTING
2018-06-21 14:24:14 updateBetaFeaturesUserCounts Special:MainPage prefs=["advancedsearch"] requestId=81adeb01fc1a2222a0c4b9fa (id=376987,timestamp=20180614122132) t=132 error=Wikimedia\Rdbms\DBQueryError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: REPLACE INTO `bw_betafeatures_user_counts` () VALUES ()
Function: UpdateBetaFeatureUserCountsJob::run
Error: 1364 Field 'feature' doesn't have a default value (127.0.0.1:3312)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 21 2018, 2:30 PM
Reedy added a subscriber: Reedy.EditedJun 21 2018, 3:25 PM

Query: REPLACE INTO bw_betafeatures_user_counts () VALUES ()

Was the query like that? No fields and no values?

The problem looks to be that the extension doesn't look if there's any rows to replace... Just whether $res evaluates to false (but it can be an object and have no rows)

		if ( !$res ) {
			return false;
		}

		$rows = [];
		foreach ( $res as $row ) {
			$rows[] = [
				'feature' => $row->feature,
				'number' => $row->number,
			];
		}

		$dbw->replace(
			'betafeatures_user_counts',
			[ 'feature' ],
			$rows,
			__METHOD__
		);

Change 441401 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/BetaFeatures@master] Don't run replace if there's no rows to replace

https://gerrit.wikimedia.org/r/441401

Vvjjkkii renamed this task from Error: 1364 Field 'feature' doesn't have a default value to xiaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: gerritbot, Aklapper.
A2093064 renamed this task from xiaaaaaaaa to Error: 1364 Field 'feature' doesn't have a default value.Jul 1 2018, 1:21 AM
A2093064 raised the priority of this task from High to Needs Triage.
A2093064 updated the task description. (Show Details)
A2093064 added subscribers: gerritbot, Aklapper.

Change 441401 merged by jenkins-bot:
[mediawiki/extensions/BetaFeatures@master] Don't run replace if there's no rows to replace

https://gerrit.wikimedia.org/r/441401

Reedy closed this task as Resolved.Aug 3 2018, 12:17 AM
Reedy claimed this task.
Reedy removed a project: Patch-For-Review.