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

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.
Xiplus renamed this task from xiaaaaaaaa to Error: 1364 Field 'feature' doesn't have a default value.Jul 1 2018, 1:21 AM
Xiplus raised the priority of this task from High to Needs Triage.
Xiplus updated the task description. (Show Details)
Xiplus 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 claimed this task.
Reedy removed a project: Patch-For-Review.