diff --git a/spec/ParseQuery.spec.js b/spec/ParseQuery.spec.js index 8eee6098..b7b6621e 100644 --- a/spec/ParseQuery.spec.js +++ b/spec/ParseQuery.spec.js @@ -274,6 +274,21 @@ describe('Parse.Query testing', () => { }); }); + it('containedIn null array', (done) => { + const emails = ['contact@xyz.com', 'contact@zyx.com', null]; + const user = new Parse.User(); + user.setUsername(emails[0]); + user.setPassword('asdf'); + user.signUp().then(() => { + const query = new Parse.Query(Parse.User); + query.containedIn('username', emails); + return query.find({ useMasterKey: true }); + }).then((results) => { + equal(results.length, 1); + done(); + }, done.fail); + }); + it("containsAll number array queries", function(done) { var NumberSet = Parse.Object.extend({ className: "NumberSet" }); diff --git a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js index 07801bd6..6cdac7ad 100644 --- a/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js +++ b/src/Adapters/Storage/Postgres/PostgresStorageAdapter.js @@ -301,8 +301,10 @@ const buildWhereClause = ({ schema, query, index }) => { const inPatterns = []; values.push(fieldName); baseArray.forEach((listElem, listIndex) => { - values.push(listElem); - inPatterns.push(`$${index + 1 + listIndex}`); + if (listElem !== null) { + values.push(listElem); + inPatterns.push(`$${index + 1 + listIndex}`); + } }); patterns.push(`$${index}:name ${not} IN (${inPatterns.join(',')})`); index = index + 1 + inPatterns.length;