Postgres: Properly handle undefined field values (#4186)
Prevents `UnhandledPromiseRejectionWarning: Unhandled promise rejection` when building queries.
This commit is contained in:
committed by
Florent Vilmart
parent
cf630ba462
commit
9371958a09
@@ -1248,7 +1248,6 @@ describe('Parse.ACL', () => {
|
|||||||
var user = req.object;
|
var user = req.object;
|
||||||
var acl = new Parse.ACL(user);
|
var acl = new Parse.ACL(user);
|
||||||
user.setACL(acl);
|
user.setACL(acl);
|
||||||
console.log('IN AFTER SAVE!');
|
|
||||||
user.save(null, {useMasterKey: true}).then(user => {
|
user.save(null, {useMasterKey: true}).then(user => {
|
||||||
new Parse.Query('_User').get(user.objectId).then(() => {
|
new Parse.Query('_User').get(user.objectId).then(() => {
|
||||||
fail('should not have fetched user without public read enabled');
|
fail('should not have fetched user without public read enabled');
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ const buildWhereClause = ({ schema, query, index }) => {
|
|||||||
patterns.push(`${name} = '${fieldValue}'`);
|
patterns.push(`${name} = '${fieldValue}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fieldValue === null) {
|
} else if (fieldValue === null || fieldValue === undefined) {
|
||||||
patterns.push(`$${index}:name IS NULL`);
|
patterns.push(`$${index}:name IS NULL`);
|
||||||
values.push(fieldName);
|
values.push(fieldName);
|
||||||
index += 1;
|
index += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user