#888 ✓not-applicable
Michael Aufreiter

Query confusion

Reported by Michael Aufreiter | June 6th, 2009 @ 04:44 AM

Under certain conditions, the wrong queries are generated.

I've put together an example:
http://gist.github.com/124785

Cheers,
Michael

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 6th, 2009 @ 06:17 AM

    • State changed from “unconfirmed” to “accepted”

    I can confirm this is the case with dm-core/next.

    While the last SELECT statement is what I would expect given how SEL works, I would not expect the last statement to return 0 like that.

    I'm going to try this code with SEL commented out and see if it makes a difference, and then start debugging from there.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 6th, 2009 @ 06:27 AM

    • State changed from “accepted” to “not-applicable”

    Actually, it appears as if this is a case of the variable in the block clobbering the "task" variable in the outer scope. Renaming the variable in the block from "task" to something else causes the problem to go away.

    The SELECT statement at the end was caused because the "task" variable it was asking for the sub_tasks on belonged to the collection returned from task.project.tasks. Since the collection included task 1 and task 2, it issued the query using an IN() statement as expected.

    Michael: I am closing this ticket for now, but if you have found a Query problem that is unrelated to the error in the submitted file, please add a comment with a new test case and I will reopen this ticket.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) June 6th, 2009 @ 06:30 AM

    Attached is a script to demonstrate that this problem is resolved.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Attachments

Pages