-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Date range call with id query always returns empty set #232
Comments
Id >= null, eh? That sure looks buggy to me. |
I can't repro this. I added a test for it, "test all, using id-range, and less-than-or-equal and greater-than-or-equal with createdAt": The tests pass in all the supported adapters: https://travis-ci.org/geddy/model/builds/38560682 Here's the generated SQL for the auto-increment ID tests (UUID string yields the same results): SELECT "people"."id" AS "Person#id", "people"."created_at" AT TIME ZONE 'UTC' AS "Person#createdAt", "people"."updated_at" AT TIME ZONE 'UTC' AS "Person#updatedAt", "people"."family_name" AS "Person#familyName", "people"."given_name" AS "Person#givenName", "people"."title" AS "Person#title", "people"."description" AS "Person#description", "people"."child_person_id" AS "Person#childPersonId", "people"."admin_event_id" AS "Person#adminEventId", "people"."owner_event_id" AS "Person#ownerEventId"
FROM people people
WHERE ("people"."id" IN (916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935) AND "people"."created_at" <= '2014-10-21T01:30:48.990' AND "people"."created_at" >= '2014-10-21T01:30:38.990'); Could you provide a bit more information? It sounds like you're using Geddy v13, which is Model v6. |
OK. Hmm. Only thing that I see different is that I'm using UUID strings as IDs and you're using integers. I tried it with v0.12.12 (model 0.5.16) and 13.0.4 (model 6.0.1) with the same results. I'll go through it tomorrow to make sure that the problem is real and report back. |
this works:
model.Person.all({createdAt: {lt: ltVal, gt: gtVal}}, ...
this also works:
model.Person.all({id: ids, createdAt: {lt: ltVal}}, ...
this returns an empty set, even though it should return rows
model.Person.all({id: ids, createdAt: {lt: ltVal, gt: gtVal}}}, ...
seems like using a date range with an id will return an empty array every time
I tested with 13.0.4
here's what I see in the SQL, here's a good one
model.Person.all({id: ids, createdAt: {gte: gte}}, ...
and now a problematic one
model.Person.all({id: ids, createdAt: {lt: ltVal, gt: gtVal}}}, ...
The text was updated successfully, but these errors were encountered: