Ask Your Question
0

Question missing from question_revision table!

asked Oct 29 '10

Benoit gravatar image Benoit flag of United States
825 6 24

updated Nov 10 '10

Evgeny gravatar image Evgeny flag of Chile
6665 31 49 95
http://askbot.org/

I don't know how it could have gotten in this state, but I have 3 questions in my database that do not have an entry in the question_revision table.

The questions display fine, but whenever I try to edit the question, I get an exception in query.py in __getitem__

Note that the ID in the table are sequential. There is no hole...

A few questions:

  • Any idea why this happened?
  • Easy way to fix?
  • Should there be code to catch an empty revision? (I would think not...This is a DB issue)

1 Answer

Sort by ยป oldest newest most voted
0
Benoit has selected this answer as correct

answered Oct 29 '10

Evgeny gravatar image Evgeny flag of Chile
6665 31 49 95
http://askbot.org/

updated Oct 29 '10

Something muste be out of hand. I've seen this problem on an installation where the program was trowing an exception between the time question is saved and the revision is intended to be saved.

The exception was SMTPError, but in your case it could be something else, like for example some people missing EmailFeedSetting values for those accounts that you have created programmatically.

There are management commands that "bandaid" that and related issues, but to really fix this we need to find what throws the exception and why.

python manage.py fix_revisionless_posts #will create an initial revision
python manage.py fix_answer_counts #fixes incorrect answer counts

You can also try postgres and the database backend. With postgres django will run every request in its own transaction and will help prevent situations where data becomes corrupted by rolling back transactions that had an uncaught exception. (With postgres you'll also get relevancy ranking on full text search and automatically "and"ed search. In mysql search is "od"ed and is not very specific). In MySQL at the moment you have to choose between support of transactions and the full text search capability.

link

Comments

the fix_revisionless_posts will make revision pages display fine, but the problem will probably re-appear when you try to edit that post until you fix the problem of missing email subscription settings. Evgeny (Oct 29 '10)
That worked. While postgres sounds interesting, I'm not sure about migrating my data. That's something I'll have to investigate *sigh* Benoit (Oct 29 '10)
I'll migrate the data here and write up on this. Supposedly all you need to do is to delete table creation SQL from the MySQL dump and replace "" with \", but still need to try here. Evgeny (Oct 29 '10)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: Oct 29 '10

Seen: 42 times

Last updated: Nov 10 '10