Last modified: 2014-02-05 20:00:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T58542, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 56542 - Database::upsert does not handle sequences for the insert
Database::upsert does not handle sequences for the insert
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.22.0
All All
: Normal major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-03 18:37 UTC by db [inactive,noenotif]
Modified: 2014-02-05 20:00 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description db [inactive,noenotif] 2013-11-03 18:37:11 UTC
The function Database::upsert (added with Gerrit change #62106) has to get new sequence numbers to support databases, which does not have AUTO_INCREMENT, see Database::nextSequenceValue

This makes the function unusable in Oracle, Postgres and Mssql on tables with a sequence.
Comment 1 Umherirrender 2014-01-03 20:16:18 UTC
This can be done already by adding the sequence value to the insert rows given to upsert, but that means more sequence numbers are used, because not all rows must be inserted. But when "nextval" on a INSERT IGNORE will also reserve the next sequence number for ignored rows, than there is no different as given it outside.
Comment 2 Umherirrender 2014-01-03 20:32:45 UTC
Maybe something like done in DatabaseOracle can be used, where the field for the sequence is added automatically to the insert part, this avoids changes to the rest of core. triggers on oracle maybe another option.

I have no oracle to do this.
Comment 3 Aaron Schulz 2014-01-03 20:40:53 UTC
Doesn't Postgres have DEFAULT NEXTVAL('some_seq') and SERIAL columns?
Comment 4 Umherirrender 2014-01-03 20:48:44 UTC
Postgres is using DEFAULT NEXTVAL, but not Oracle. I found that Oracle will support DEFAULT NEXTVAL with version 12c, but MediaWiki supports Oracle 9.0.1 or later at the moment.

Mssql also has sequence support (Implemented Database::nextSequenceValue), but I do not know how that works there (looks not like nativ sequences).
Comment 5 db [inactive,noenotif] 2014-02-05 20:00:11 UTC
For upsert on Oracle bug 53710 exists, postgres has no problem, so there is no need to keep this open (but it is not a real dup, so marking INVALID)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links