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

Commit 5f901b1d by Jan Aagaard Meier

Merge pull request #2406 from paul-sh/master

count() returned NaN with Postgres and quoteIdentifiers=false
2 parents 8adb7481 ec62941a
Showing with 15 additions and 5 deletions
......@@ -865,7 +865,7 @@ module.exports = (function() {
options.includeIgnoreAttributes = false;
options.limit = null;
return this.aggregate(col, 'COUNT', options);
return this.aggregate(col, 'count', options);
};
/**
......
......@@ -536,14 +536,24 @@ if (dialect.match(/^postgres/)) {
where: {fullName: "John Smith"}
})
.success(function(user2) {
self.sequelize.options.quoteIndentifiers = true
self.sequelize.getQueryInterface().QueryGenerator.options.quoteIdentifiers = true
self.sequelize.options.logging = false
// We can map values back to non-quoted identifiers
expect(user2.id).to.equal(user.id)
expect(user2.username).to.equal('user')
expect(user2.fullName).to.equal('John Smith')
done()
// We can query and aggregate by non-quoted identifiers
self.User
.count({
where: {fullName: "John Smith"}
})
.success(function(count) {
self.sequelize.options.quoteIndentifiers = true
self.sequelize.getQueryInterface().QueryGenerator.options.quoteIdentifiers = true
self.sequelize.options.logging = false
expect(count).to.equal(1)
done()
})
})
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!