Ask Your Question

Upgrade error: canceling statement due to statement timeout

asked 2013-01-31 18:23:39 -0500

alekcac gravatar image

updated 2013-02-02 16:54:18 -0500

Evgeny gravatar image

I tried to upgrade askbot from 0.7.43 to 0.7.48. But got the following errors: 1) In migrate process:

 - Migrating forwards to 0161_add_field__user_languages.
 > askbot:0158_add_title_search_indices_for_postgresql_and_mysql
Traceback (most recent call last):
  File "", line 11, in <module>
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/", line 459, in execute_manager
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/", line 382, in execute
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/core/management/", line 232, in execute
    output = self.handle(*args, **options)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/management/commands/", line 105, in handle
    ignore_ghosts = ignore_ghosts,
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 191, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 221, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 292, in migrate_many
    result = self.migrate(migration, database)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 125, in migrate
    result =
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 99, in run
    return self.run_migration(migration)
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 81, in run_migration
  File "/home/alekcac/lib/python2.7/South-0.7.3-py2.7.egg/south/migration/", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/home/alekcac/webapps/askbot_webapp_7_48/myaskbot/askbot/migrations/", line 33, in forwards
  File "/home/alekcac/webapps/askbot_webapp_7_48/myaskbot/askbot/search/postgresql/", line 21, in setup_full_text_search
  File "/home/alekcac/webapps/askbot_webapp_7_48/lib/python2.7/django/db/backends/postgresql_psycopg2/", line 52, in execute
    return self.cursor.execute(query, args)
django.db.utils.DatabaseError: canceling statement due to statement timeout
CONTEXT:  PL/pgSQL function "get_thread_question_tsv" line 9 at RETURN
PL/pgSQL function "thread_update_trigger" line 3 at assignment
SQL statement "UPDATE askbot_thread SET id=new.thread_id WHERE id=new.thread_id"
PL/pgSQL function "post_trigger" line 12 at SQL statement
SQL statement "UPDATE askbot_post SET text_search_vector=NULL"
PL/pgSQL function "add_tsvector_column" line 11 at EXECUTE statement

2) When I tried to open any question I get:

column askbot_thread.language_code does not exist
LINE 1: ...ivity_at", "askbot_thread"."last_activity_by_id", "askbot_th...

Could you give any advice about it?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-02-02 16:52:46 -0500

Evgeny gravatar image

updated 2013-03-08 11:38:24 -0500

To work around this specific issue, you might try temporarily change the statement_timeout parameter in your database.

Find the file postgresql.conf, change the value there, restart the database, then run the migrations. Default value for the statement timeout is 0, which means the timeout is turned off.

The second issue is due to incomplete migrations. Any time you see something like "column X does not exist" it means the database is not in sync with the code and most likely means that some migrations were not run.

edit: if you can't change the postgres.conf file, then you can try running the postgres scripts used in the failing migration manually like so:

PGOPTIONS="-c statement_timeout=60000" psql -U dbuser dbname < the_script.sql

Then fake-apply the corresponding migration.

Also: not verified, but it's possible that the statement timeout in the postgresql backend can be configured in django via options to the DATABASES setting, please investigate.

edit flag offensive delete link more

answered 2013-02-01 03:20:04 -0500

coldsystem gravatar image

i have the same issues. 3 days to upgrade from 0.7.43 to 0.7.48 (Sqlite3) with no results.

#file corupted of encrypted #disk img error #Database error

My site is working fine with 0.7.43.

iam asking the admins of askbot to make a small script to make this migration possible !!!

nightmare migration :(

edit flag offensive delete link more


sqlite is different though.

Evgeny gravatar image Evgeny  ( 2013-02-02 16:35:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-01-31 18:23:39 -0500

Seen: 4,288 times

Last updated: Mar 08 '13