GNOME Bugzilla – Bug 494351
SqliteSyntaxException: Expression tree is too large - when deleting many pictues from my catalog at once
Last modified: 2008-05-06 14:44:53 UTC
I have around 3000 pictures in my catalog. If I want to delete them all at once from my catalog I get the following exception: Unhandled Exception: Mono.Data.SqliteClient.SqliteSyntaxException: Expression tree is too large (maximum depth 1000) at Mono.Data.SqliteClient.SqliteCommand.GetNextStatement (IntPtr pzStart, System.IntPtr& pzTail, System.IntPtr& pStmt) [0x00000] at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32& rows_affected) [0x00000] at Mono.Data.SqliteClient.SqliteCommand.ExecuteNonQuery () [0x00000] at Banshee.Database.QueuedSqliteCommand.Execute () [0x00000] Query: SELECT photos.id, photos.time, photos.directory_path, photos.name, photos.description, photos.roll_id, photos.default_version_id FROM photos ORDER BY photos.time
Created attachment 103241 [details] [review] sqlite-expression-too-deep-on-delete.patch dirty fix.
That's pretty awful. :) See http://www.sqlite.org/limits.html (item 5) - SQLITE_MAX_EXPR_DEPTH is only 1000 by default. A quick search suggested that using 'WHERE id IN (a,b,c,...,n)' avoids the problem altogether: http://www.mail-archive.com/sqlite-users@sqlite.org/msg30804.html
Created attachment 103973 [details] [review] sqlite-expression-too-deep-on-delete.patch updated patch which takes advantage of Tim's suggestion. Seems to work fine! Thanks! There's maybe a better way to convert photo_id to string, right?
*** Bug 522108 has been marked as a duplicate of this bug. ***
slightly different version committed as r3754
*** Bug 523851 has been marked as a duplicate of this bug. ***
*** Bug 524342 has been marked as a duplicate of this bug. ***
*** Bug 531753 has been marked as a duplicate of this bug. ***