Ask Your Question
0

DatabaseError: column askbot_thread.text_search_vector does not exist

asked 2012-02-28 08:02:32 -0600

DavyLandman gravatar image

updated 2012-02-28 09:16:01 -0600

Hi Guys,

I recently upgraded from 0.29 to the latest git-master and everything worked fine (love the migrations!)

but some pages (example: questions/scope:all/sort:activity-desc/query:dissapear/page:3/) generate a 500 server error with the following message:

 VariableDoesNotExist: Failed lookup for key [request] in u'[{}]'

but if I look in the askbot.log I actually see this error occuring:

/opt/python-2.7.2/lib/python2.7/site-packages/django/core/handlers/base.py TIME: 2012-02-28 14:42:10,377 MSG: base.py:handle_uncaught_exception:209 Internal Server Error: /questions/scope:all/sort:activity-desc/query:dissapear/page:3/
Traceback (most recent call last):
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/srv/www/vhosts/askbot/askbot/views/readers.py", line 80, in questions
    if paginator.num_pages < search_state.page:
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/core/paginator.py", line 60, in _get_num_pages
    if self.count == 0 and not self.allow_empty_first_page:
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/core/paginator.py", line 48, in _get_count
    self._count = self.object_list.count()
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/db/models/query.py", line 334, in count
    return self.query.get_count(using=self.db)
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/db/models/sql/query.py", line 401, in get_count
    number = obj.get_aggregation(using=using)[None]
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/db/models/sql/query.py", line 367, in get_aggregation
    result = query.get_compiler(using).execute_sql(SINGLE)
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
    cursor.execute(sql, params)
  File "/opt/python-2.7.2/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
DatabaseError: column askbot_thread.text_search_vector does not exist
LINE 1: ...estion'  AND "askbot_post"."deleted" = false  AND askbot_thr...

Is this a bug or did something go wrong with the migrations?

syncdb output:

> python manage.py syncdb
Syncing...
Creating tables ...
Installing custom SQL ...
Installing indexes ...
No fixtures found.

Synced:
 > django.contrib.auth
 > django.contrib.contenttypes
 > django.contrib.sessions
 > django.contrib.sites
 > django.contrib.staticfiles
 > django.contrib.admin
 > django.contrib.sitemaps
 > south
 > askbot.deps.livesettings
 > keyedcache
 > robots
 > django_countries
 > djcelery
 > djkombu
 > followit

Not synced (use migrations):
 - askbot.deps.django_authopenid
 - askbot
(use ./manage.py migrate to migrate these)

migrate output:

> python manage.py migrate
Running migrations for django_authopenid:
- Nothing to migrate.
 - Loading initial data for django_authopenid.
No fixtures found.
Running migrations for askbot:
- Nothing to migrate.
 - Loading initial data for askbot.
No fixtures found.

(running against a postgres db)

I just ran the askbot/search/postgresql/thread_and_post_models_01162012.plsql file:

> psql -U askbot -f askbot/search/postgresql/thread_and_post_models_01162012.plsql 
Password for user askbot: 
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
 setup_aggregates 
------------------
 t
(1 row)

CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:154: ERROR:  cannot ...
(more)
edit retag flag offensive close merge delete

Comments

In this case looks like the .plsql file is incorrect. Take a look at the repository and compare with yours https://github.com/ASKBOT/askbot-devel/blob/master/askbot/search/postgresql/thread_and_post_models_01162012.plsql#L172 there is no code like the traceback is showing on line 172.

Evgeny gravatar imageEvgeny ( 2012-02-28 09:12:46 -0600 )edit

Which version of postgres are you using? Maybe the function get_dependend_answers_tsv could not be replaced successfully? You could try dropping those functions beforehand...

Evgeny gravatar imageEvgeny ( 2012-02-28 09:21:43 -0600 )edit

it's a clean clone from github. I do not know about the line numbers reported but if I open the file and check line 172 is shows the same as in github.

DavyLandman gravatar imageDavyLandman ( 2012-02-28 09:25:40 -0600 )edit

postgres (PostgreSQL) 9.1.1

DavyLandman gravatar imageDavyLandman ( 2012-02-28 09:27:03 -0600 )edit

Ok, maybe it's due to the version of postgres, we use 8.4. Try dropping any functions installed by the .plsql script and then running it again. The first error message is at line 154, so I'd start with that function. Ideally we need a script that runs on as many versions of the database as possible, failing that, we'll add some conditional statements in the python code. The line 172 shows stale code from the function that could not be replaced for some reason.

Evgeny gravatar imageEvgeny ( 2012-02-28 09:34:05 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-02-28 08:23:15 -0600

Evgeny gravatar image

Possibly in your case migration 106 did not succeed, most likely because your postgres does not have procedural language called plpgsql installed.

Please try logging in to the database shell and type

CREATE LANGUAGE plpgsql;

The command may still fail, because it apparently did not work for you, but will give a hint. Looks like migration is not catching some error condition.

Also you can try running this query askbot/search/postgresql/thread_and_post_models_01162012.plsql directly into the database.

The error messages should suggest something. Often it is a permission error.

edit flag offensive delete link more

Comments

askbot=&gt; CREATE LANGUAGE plpgsql; ERROR: language "plpgsql" already exists

DavyLandman gravatar imageDavyLandman ( 2012-02-28 08:59:55 -0600 )edit

I've added the output of the .plsql file to the question.

DavyLandman gravatar imageDavyLandman ( 2012-02-28 09:04:14 -0600 )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

Stats

Asked: 2012-02-28 08:02:32 -0600

Seen: 776 times

Last updated: Feb 28 '12