Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit ec62941a
authored
Oct 08, 2014
by
paul-sh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Model.count() and findAndCountAll() returned NaN with Postgres and quoteIdentifiers==false.
1 parent
60ab9024
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
lib/model.js
test/postgres/dao.test.js
lib/model.js
View file @
ec62941
...
...
@@ -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
);
};
/**
...
...
test/postgres/dao.test.js
View file @
ec62941
...
...
@@ -536,13 +536,22 @@ 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'
)
// 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
()
})
})
...
...
@@ -550,4 +559,5 @@ if (dialect.match(/^postgres/)) {
})
})
})
})
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment