Page MenuHomePhabricator

With SQLite only first consumer can be created
Closed, ResolvedPublic

Description

For next consumer MediaWiki reports a query error. (Not sure how to get details of it.)


Version: unspecified
Severity: normal

Details

Reference
bz70927

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:49 AM
bzimport set Reference to bz70927.
bzimport added a subscriber: Unknown Object (MLST).
Mitar created this task.Sep 17 2014, 6:49 AM
Reedy added a comment.Sep 17 2014, 3:47 PM

If you could set the code below in your LocalSettings, then report back with the actual SQL error, that'd be really helpful

$wgShowSQLErrors = true;
$wgDebugDumpSql = true;
$wgShowDBErrorBacktrace = true;

Mitar added a comment.Sep 17 2014, 3:51 PM

Query:
INSERT INTO oauth_registered_consumer (oarc_id,oarc_consumer_key,oarc_name,oarc_user_id,oarc_version,oarc_callback_url,oarc_callback_is_prefix,oarc_description,oarc_email,oarc_email_authenticated,oarc_wiki,oarc_grants,oarc_registration,oarc_secret_key,oarc_rsa_key,oarc_restrictions,oarc_stage,oarc_stage_timestamp,oarc_deleted) VALUES ('0','9059fa99ba97e07b0c7f1933b9866ff0','Foo','1','1.0','http://localhost',0,'Foo','mitar@example.com','20140917154912','*','["useoauth"]','20140917154912','46dcd00794246f24ebc649acdf2eac55','','{"IPAddresses":["0.0.0.0/0","::/0"]}','0','20140917154912','0')
Function: MediaWiki\Extensions\OAuth\MWOAuthDAO::save/single-row
Error: 19 PRIMARY KEY must be unique

#0 ./Temp/mediawiki-1.23.2/includes/db/Database.php(1123): DatabaseBase->reportQueryError('PRIMARY KEY mus...', 19, 'INSERT INTO oa...', 'MediaWiki\\Exten...', false)
#1 ./Temp/mediawiki-1.23.2/includes/db/Database.php(1920): DatabaseBase->query('INSERT INTO oa...', 'MediaWiki\\Exten...')
#2 ./Temp/mediawiki-1.23.2/includes/db/DatabaseSqlite.php(579): DatabaseBase->insert('oauth_registere...', Array, 'MediaWiki\\Exten...', Array)
#3 [internal function]: DatabaseSqlite->insert('oauth_registere...', Array, 'MediaWiki\\Exten...')
#4 ./Temp/mediawiki-1.23.2/includes/db/LoadBalancer.php(1186): call_user_func_array(Array, Array)
#5 ./Temp/OAuth/backend/MWOAuthDAO.php(179): DBConnRef->__call('insert', Array)
#6 ./Temp/OAuth/backend/MWOAuthDAO.php(179): DBConnRef->insert('oauth_registere...', Array, 'MediaWiki\\Exten...')
#7 ./Temp/OAuth/control/MWOAuthConsumerSubmitControl.php(204): MediaWiki\Extensions\OAuth\MWOAuthDAO->save(Object(DBConnRef))
#8 ./Temp/OAuth/control/MWOAuthSubmitControl.php(76): MediaWiki\Extensions\OAuth\MWOAuthConsumerSubmitControl->processAction('propose')
#9 ./Temp/OAuth/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php(193): MediaWiki\Extensions\OAuth\MWOAuthSubmitControl->submit()
#10 [internal function]: MediaWiki\Extensions\OAuth\SpecialMWOAuthConsumerRegistration->MediaWiki\Extensions\OAuth\{closure}(Array, Object(HTMLForm))
#11 ./Temp/mediawiki-1.23.2/includes/htmlform/HTMLForm.php(470): call_user_func(Object(Closure), Array, Object(HTMLForm))
#12 ./Temp/mediawiki-1.23.2/includes/htmlform/HTMLForm.php(412): HTMLForm->trySubmit()
#13 ./Temp/mediawiki-1.23.2/includes/htmlform/HTMLForm.php(427): HTMLForm->tryAuthorizedSubmit()
#14 ./Temp/OAuth/frontend/specialpages/SpecialMWOAuthConsumerRegistration.php(201): HTMLForm->show()
#15 ./Temp/mediawiki-1.23.2/includes/specialpage/SpecialPage.php(379): MediaWiki\Extensions\OAuth\SpecialMWOAuthConsumerRegistration->execute('propose')
#16 ./Temp/mediawiki-1.23.2/includes/specialpage/SpecialPageFactory.php(503): SpecialPage->run('propose')
#17 ./Temp/mediawiki-1.23.2/includes/Wiki.php(285): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#18 ./Temp/mediawiki-1.23.2/includes/Wiki.php(588): MediaWiki->performRequest()
#19 ./Temp/mediawiki-1.23.2/includes/Wiki.php(447): MediaWiki->main()
#20 ./Temp/mediawiki-1.23.2/index.php(46): MediaWiki->run()
#21 {main}

Reedy added a comment.EditedSep 17 2014, 4:08 PM
CREATE UNIQUE INDEX /*i*/oarc_consumer_key
    ON /*_*/oauth_registered_consumer (oarc_consumer_key);
CREATE UNIQUE INDEX /*i*/oarc_name_version_user
    ON /*_*/oauth_registered_consumer (oarc_name,oarc_user_id,oarc_version);

The extensions should handle it better, but it seems like you're reusing something that causes a conflict with the indexes above

Mitar added a comment.Sep 17 2014, 4:17 PM

I removed all indexes and it is still failing. I think the issue is that you are explicitly setting oarc_id to '0'. I think it should be NULL to be autogenerated/autoincremented.

Aklapper triaged this task as Lowest priority.Mar 17 2015, 10:56 AM
Aklapper added a subscriber: Aklapper.
Reedy added a subscriber: Reedy.Oct 31 2016, 2:50 PM

Is this still an issue?

Anomie closed this task as Resolved.Oct 31 2016, 3:04 PM
Anomie assigned this task to Arlolra.

This looks like it was fixed by rEOAUe2343559b356: Don't normalize away null values. Feel free to reopen if that's not the case.