After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 494351 - SqliteSyntaxException: Expression tree is too large - when deleting many pictues from my catalog at once
SqliteSyntaxException: Expression tree is too large - when deleting many pict...
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: General
0.4.x
Other Linux
: Normal normal
: ---
Assigned To: F-spot maintainers
F-spot maintainers
: 522108 523851 524342 531753 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-06 22:48 UTC by László Monda
Modified: 2008-05-06 14:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sqlite-expression-too-deep-on-delete.patch (2.45 KB, patch)
2008-01-20 09:25 UTC, Maxxer
none Details | Review
sqlite-expression-too-deep-on-delete.patch (1.89 KB, patch)
2008-01-29 18:12 UTC, Maxxer
committed Details | Review

Description László Monda 2007-11-06 22:48:58 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
Comment 1 Maxxer 2008-01-20 09:25:45 UTC
Created attachment 103241 [details] [review]
sqlite-expression-too-deep-on-delete.patch

dirty fix.
Comment 2 Tim Retout 2008-01-29 13:56:20 UTC
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
Comment 3 Maxxer 2008-01-29 18:12:40 UTC
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?
Comment 4 Maxxer 2008-03-12 22:23:02 UTC
*** Bug 522108 has been marked as a duplicate of this bug. ***
Comment 5 Stephane Delcroix 2008-03-13 16:30:39 UTC
slightly different version committed as r3754
Comment 6 Maxxer 2008-03-22 16:28:27 UTC
*** Bug 523851 has been marked as a duplicate of this bug. ***
Comment 7 Stephane Delcroix 2008-03-25 17:34:18 UTC
*** Bug 524342 has been marked as a duplicate of this bug. ***
Comment 8 Maxxer 2008-05-06 14:44:53 UTC
*** Bug 531753 has been marked as a duplicate of this bug. ***