不要怂,就是干,撸起袖子干!

Commit 56647604 by Mick Hansen

Merge pull request #1410 from ruifortes/master

fix adding duplicate PK attributes in select query
2 parents 5f5eb36c 0e068874
Showing with 9 additions and 1 deletions
...@@ -536,7 +536,15 @@ module.exports = (function() { ...@@ -536,7 +536,15 @@ module.exports = (function() {
}.bind(this)).join(", ") }.bind(this)).join(", ")
if (subQuery && mainAttributes) { if (subQuery && mainAttributes) {
mainAttributes = mainAttributes.concat(factory.hasPrimaryKeys ? factory.primaryKeyAttributes : ['id']) if (factory.hasPrimaryKeys) {
factory.primaryKeyAttributes.forEach(function(keyAtt){
if(mainAttributes.indexOf(keyAtt) == -1){
mainAttributes.push(keyAtt)
}
})
} else {
mainAttributes.push("id")
}
} }
// Escape attributes // Escape attributes
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!