diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index daf88df9fa..29470cc983 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -1102,10 +1102,16 @@ Zotero.DataObject.prototype._finalizeSave = Zotero.Promise.coroutine(function* ( toAdd[i][0] = yield Zotero.RelationPredicates.add(toAdd[i][0]); env.relationsToRegister.push([toAdd[i][0], toAdd[i][1]]); } - yield Zotero.DB.queryAsync( - sql + toAdd.map(x => "(?, ?, ?)").join(", "), - toAdd.map(x => [this.id, x[0], x[1]]) - .reduce((x, y) => x.concat(y)) + yield Zotero.Utilities.Internal.forEachChunkAsync( + toAdd, + Math.floor(Zotero.DB.MAX_BOUND_PARAMETERS / 3), + async function (chunk) { + await Zotero.DB.queryAsync( + sql + chunk.map(x => "(?, ?, ?)").join(", "), + chunk.map(x => [this.id, x[0], x[1]]) + .reduce((x, y) => x.concat(y)) + ); + }.bind(this) ); }