2015-03-04
| ||
19:27 | • Closed ticket [0a32885109]: IQueryable.Concat() throws "ORDER BY clause should come after UNION ALL not before" plus 2 other changes artifact: e338517199 user: mistachkin | |
2014-11-18
| ||
22:11 | • Fixed ticket [0a32885109]. artifact: 00585d96be user: mistachkin | |
2014-11-14
| ||
00:55 | Wrap SELECT statements in parenthesis if they have an ORDER BY, LIMIT, or OFFSET clause and a compound operator is involved. Fix for [0a32885109]. check-in: a0f4a5ebcf user: mistachkin tags: trunk | |
2014-11-13
| ||
23:58 | Rewrite previous fix for [0a32885109] so it retains the ORDER BY, LIMIT, and OFFSET clauses. check-in: a9d19a3b28 user: mistachkin tags: tkt-0a32885109 | |
2014-11-08
| ||
06:44 | • Pending ticket [0a32885109]: IQueryable.Concat() throws "ORDER BY clause should come after UNION ALL not before" plus 4 other changes artifact: 1fbf388097 user: mistachkin | |
06:41 | Do not emit ORDER BY, LIMIT, and OFFSET clauses for the left SELECT statement when a compound operator is involved. Candidate fix for [0a32885109]. check-in: 1f05aa9dd6 user: mistachkin tags: tkt-0a32885109 | |
03:50 | • Ticket [0a32885109] IQueryable.Concat() throws "ORDER BY clause should come after UNION ALL not before" status still Verified with 3 other changes artifact: ff84170068 user: mistachkin | |
02:24 | • Ticket [0a32885109]: 4 changes artifact: d0d678456a user: mistachkin | |
02:14 | • Verified ticket [0a32885109]. artifact: 5f6a40fecf user: mistachkin | |
2014-11-05
| ||
19:00 | • Ticket [0a32885109]: 7 changes artifact: 4c080ac2b8 user: mistachkin | |
2014-11-04
| ||
09:14 | • New ticket [0a32885109]. artifact: 06703df28d user: anonymous | |
Ticket Hash: | 0a32885109ae9460e38faf34aa7d3383c54077ca | |||
Title: | IQueryable.Concat() throws "ORDER BY clause should come after UNION ALL not before" | |||
Status: | Closed | Type: | Code_Defect | |
Severity: | Minor | Priority: | Blocker | |
Subsystem: | LINQ | Resolution: | Fixed | |
Last Modified: | 2015-03-04 19:27:12 | |||
Version Found In: | 1.0.94 | |||
User Comments: | ||||
anonymous added on 2014-11-04 09:14:01:
I try concatenating 2 queries: var files1 = context.Files.Where(f => f.ParentFolder.SubFolders.Any()).OrderByDescending(f => f.Size).Take(10); var files2 = context.Files.Where(f => !f.ParentFolder.SubFolders.Any()).OrderByDescending(f => f.Size).Take(10); foreach(var file in files1.Concat(files2)) [...] Throws SQLiteException: SQL logic error or missing database ORDER BY clause should come after UNION ALL not before at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain) at System.Data.SQLite.SQLiteCommand.BuildNextCommand() at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext) at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) Since I'm only interrested of the 10 largest files of both groups I see no chance in reordering my query. But I have to admit that for this query its not important that SQLite is doing the concatenation so in this case a fallback to IEnumerable works well: foreach(var file in files1.AsEnumerable().Concat(files2)) [...] mistachkin added on 2014-11-05 19:00:00: Blocking 1.0.95.0 until the root cause is known. mistachkin added on 2014-11-08 02:14:30: Do you have an example schema (and entity model) that demonstrates the issue? mistachkin added on 2014-11-08 02:24:55: This is also an issue with the LIMIT and OFFSET clauses. mistachkin added on 2014-11-08 03:50:57: I was able to reproduce the issue locally. mistachkin added on 2014-11-08 06:44:16: There is now a candidate fix for this issue on the tkt-0a32885109 branch: [/timeline?r=tkt-0a32885109] Basically, the fix is to disallow the left SELECT statement of a compound operator from having an ORDER BY, LIMIT, or OFFSET clause. Please let us know if this clears up the issue for you. |