Skip to content

Commit bba5f71

Browse files
committed
improve logic
1 parent c73fda8 commit bba5f71

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

spec/ParseQuery.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('Parse.Query testing', () => {
247247
query.notContainedIn('value', []);
248248

249249
const results = await query.find();
250-
equal(results.length, 0);
250+
equal(results.length, 1);
251251
});
252252

253253
it('query containedIn on empty array', async () => {

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,12 @@ const buildWhereClause = ({ schema, query, index }): WhereClause => {
431431
patterns.push(`$${index}:name IS NULL`);
432432
index = index + 1;
433433
} else {
434-
patterns.push(`$${index}:name ${not} IN (null)`);
435-
values.push(fieldName);
436-
index += 1;
434+
// Handle empty array
435+
if (notIn) {
436+
patterns.push('1 = 1'); // Return all values
437+
} else {
438+
patterns.push('1 = 2'); // Return no values
439+
}
437440
}
438441
};
439442
if (fieldValue.$in) {

0 commit comments

Comments
 (0)