askbot=> CREATE LANGUAGE plpgsql;
ERROR: language "plpgsql" already exists
I've added the output of the .plsql file to the question.
DavyLandman ( 2012-02-28 09:04:14 -0500 )editHi 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 change name of input parameter "question_id"
HINT: Use DROP FUNCTION first.
add_tsvector_column
---------------------
t
(1 row)
add_tsvector_column
---------------------
t
(1 row)
UPDATE 354
UPDATE 178
UPDATE 105
UPDATE 283
UPDATE 105
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:172: ERROR: relation "answer" does not exist
LINE 1: SELECT concat_tsvectors(text_search_vector) FROM answer WHER...
^
QUERY: SELECT concat_tsvectors(text_search_vector) FROM answer WHERE question_id = 7 AND deleted=false
CONTEXT: PL/pgSQL function "get_dependent_answers_tsv" line 9 at FOR over EXECUTE statement
CREATE FUNCTION
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:186: NOTICE: trigger "thread_search_vector_update_trigger" for table "askbot_thread" does not exist, skipping
DROP TRIGGER
CREATE TRIGGER
CREATE FUNCTION
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:197: NOTICE: trigger "thread_search_vector_insert_trigger" for table "askbot_thread" does not exist, skipping
DROP TRIGGER
CREATE TRIGGER
CREATE FUNCTION
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:218: NOTICE: trigger "post_search_vector_update_trigger" for table "askbot_post" does not exist, skipping
DROP TRIGGER
CREATE TRIGGER
psql: askbot/search/postgresql/thread_and_post_models_01162012.plsql:222: NOTICE: index "askbot_search_idx" does not exist, skipping
DROP INDEX
CREATE INDEX
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.
askbot=> CREATE LANGUAGE plpgsql;
ERROR: language "plpgsql" already exists
I've added the output of the .plsql file to the question.
DavyLandman ( 2012-02-28 09:04:14 -0500 )editCreate your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.
create your Q&A siteAsked: 2012-02-28 08:02:32 -0500
Seen: 208 times
Last updated: Feb 28 '12
Error in migration: askbot:0127_save_category_tree_as_json
sorry, system error, what to do?
comment error message: white text on yellow background
error on upvote: "Sorry, something is not right here..." [fixed]
coffin warning: cannot translate loader
Error 324 (net::ERR_EMPTY_RESPONSE): Unknown error.
Copyright Askbot, 2010-2011. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
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 ( 2012-02-28 09:12:46 -0500 )editWhich version of postgres are you using? Maybe the function
Evgeny ( 2012-02-28 09:21:43 -0500 )editget_dependend_answers_tsvcould not be replaced successfully? You could try dropping those functions beforehand...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 ( 2012-02-28 09:25:40 -0500 )editpostgres (PostgreSQL) 9.1.1
DavyLandman ( 2012-02-28 09:27:03 -0500 )editOk, 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 ( 2012-02-28 09:34:05 -0500 )edit