If my memory serves me correct the skip before a where didn't work in 3.2 at
all but seems to be ok in 3.3. I agree the semantics is different. 

Will take a deeper look in both versions with both scenarios.

Rippo




-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Oskar Berggren
Sent: 19 February 2013 13:18
To: [email protected]
Subject: Re: [nhusers] NH 3.3.3.3001 using MySQL limit bug

Taking 5, then filtering, is not the same as first filtering, then taking 5.
In 3.3.1 the SQL doesn't match the LINQ. If that is the SQL you want, you
should switch the order of Take() and Where().

See these issues:
https://nhibernate.jira.com/browse/NH-2588
https://nhibernate.jira.com/browse/NH-3320

But 2588 seems to suggest that the LINQ you have wouldn't run at all in
3.3.1. According to you it does run, so I suppose one can argue whether or
not this change is too big for a minor release.


/Oskar



2013/2/19 Rippo <[email protected]>:
> Just trying NH3.3.3.3001 against a MySql5 database and just hit this 
> show
> stopper:-
>
> "This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME 
> subquery' "
>
> Calling code:
>
> var latestCampaignList = 
> db.Session.Query<CampaignRun>().Take(5).Where(w => w.Campaign.Id == 
> id).OrderByDescending(w => w.Id).ToList();
>
> In 3.3.1.4000 I get the correct SQL
>
> select ...
> from campaignrun campaignru0_
> where campaignru0_.CampaignId=18988 /* ?p0 */ order by campaignru0_.Id 
> desc limit 5 /* ?p1 */
>
> In 3.3.3.3001 I get the following SQL
>
> select ...
> from campaignrun campaignru0_
> where campaignru0_.CampaignId=18988 /* ?p0 */ and ( campaignru0_.Id in 
> ( select campaignru1_.Id from campaignrun campaignru1_ limit 5 /* ?p1 
> */)
> )
> order by campaignru0_.Id desc
>
>
> Notice the sub query, that really shouldn't be there as its not needed 
> in MySql, Limit cannot be used in a sub query.
>
> I am using the standard
>
> x.Dialect<MySQL5Dialect>();
>
> --
> You received this message because you are subscribed to the Google 
> Groups "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to