Project

General

Profile

Bug #3615

(OperationalError) too many SQL variables on admin journal page

Added by Daniel D over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
Start date:
06.05.2016
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

Steps to reproduce:

  • use sqlite database
  • add over 1000 repos
  • open /_admin/journal

OperationalError: (OperationalError) too many SQL variables u'SELECT count(*) AS count_1 \nFROM (SELECT user_logs.user_log_id AS user_logs_user_log_id, user_logs.user_id AS user_logs_user_id, user_logs.username AS user_logs_username, user_logs.repository_id AS user_logs_repository_id, user_logs.repository_name AS user_logs_repository_name, user_logs.user_ip AS user_logs_user_ip, user_logs.action AS user_logs_action, user_logs.action_date AS user_logs_action_date \nFROM user_logs \nWHERE user_logs.repository_id IN (?, ?, ?, ?, ?, ?, ?......) ORDER BY user_logs.action_date DESC) AS anon_1' (1,2,....1001 ids)

File "/Users/dan/Projects/rc/rhodecode-enterprise-ce-dan/rhodecode/controllers/journal.py", line 262, in public_journal
c.journal_pager = Page(journal, page=p, items_per_page=20)
File "/nix/store/08jg8cv3mdsjdqa367b9gmilcmif46s3-python2.7-WebHelpers-1.3/lib/python2.7/site-packages/webhelpers/paginate.py", line 413, in __init__
self.item_count = len(self.collection)

The problem is in rhodecode.controllers.journal.JournalController:_get_journal_data()

The query it generates has an IN which can fill up to the max limit for sqlite

Possible solutions:

  • use a for loop
  • rewrite query to use joins instead

Current workarounds:

  • use mysql/postgresql

History

#1 Updated by Daniel D over 3 years ago

  • Description updated (diff)

#2 Updated by Daniel D over 3 years ago

  • Description updated (diff)

Also available in: Atom PDF