Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgrammingError: (psycopg2.ProgrammingError) relation "task_id_sequence" does not exist #68

Open
siovene opened this issue Nov 3, 2017 · 0 comments

Comments

@siovene
Copy link

siovene commented Nov 3, 2017

Hello,
apologies if this probably not an issue but something wrong in my installation instead.

When I update a model in my database, I get the following error in the celery log:

[2017-11-03 13:30:17,647: CRITICAL/MainProcess] Task celery_haystack.tasks.CeleryHaystackSignalHandler[e36a4e74-f951-469e-8151-c6359cbca277] INTERNAL ERROR: ProgrammingError('(psycopg2.ProgrammingError) relation "task_id_sequence" does not exist\nLINE 1: ...us, result, date_done, traceback) VALUES (nextval(\'task_id_s...\n                                                             ^\n',)
Traceback (most recent call last):
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/celery/app/trace.py", line 283, in trace_task
    uuid, retval, SUCCESS, request=task_request,
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/celery/backends/base.py", line 271, in store_result
    request=request, **kwargs)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/celery/backends/database/__init__.py", line 63, in _inner
    return fun(*args, **kwargs)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/celery/backends/database/__init__.py", line 125, in _store_result
    session.flush()
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2177, in flush
    self._flush(objects)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2297, in _flush
    transaction.rollback(_capture_exception=True)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 66, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2261, in _flush
    flush_context.execute()
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 389, in execute
    rec.execute(self)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 548, in execute
    uow
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 181, in save_obj
    mapper, table, insert)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 835, in _emit_insert_statements
    execute(statement, params)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/venv/astrobin/dev/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
ProgrammingError: (psycopg2.ProgrammingError) relation "task_id_sequence" does not exist
LINE 1: ...us, result, date_done, traceback) VALUES (nextval('task_id_s...
                                                             ^
 [SQL: "INSERT INTO celery_taskmeta (id, task_id, status, result, date_done, traceback) VALUES (nextval('task_id_sequence'), %(task_id)s, %(status)s, %(result)s, %(date_done)s, %(traceback)s) RETURNING celery_taskmeta.id"] [parameters: {'status': 'PENDING', 'traceback': None, 'task_id': 'e36a4e74-f951-469e-8151-c6359cbca277', 'date_done': datetime.datetime(2017, 11, 3, 13, 30, 17, 635584), 'result': None}]

My celery_taskmeta table looks like this:

# \d celery_taskmeta;
                                   Table "public.celery_taskmeta"
  Column   |           Type           |                          Modifiers                           
-----------+--------------------------+--------------------------------------------------------------
 id        | integer                  | not null default nextval('celery_taskmeta_id_seq'::regclass)
 task_id   | character varying(255)   | not null
 status    | character varying(50)    | not null
 result    | text                     | 
 date_done | timestamp with time zone | not null
 traceback | text                     | 
 hidden    | boolean                  | not null
 meta      | text                     | 
Indexes:
    "celery_taskmeta_pkey" PRIMARY KEY, btree (id)
    "celery_taskmeta_task_id_key" UNIQUE CONSTRAINT, btree (task_id)
    "celery_taskmeta_662f707d" btree (hidden)
    "celery_taskmeta_task_id_9558b198_like" btree (task_id varchar_pattern_ops)

Stuff that begins with celery_ in my database are:

celery_taskmeta                              celery_tasksetmeta
celery_taskmeta_662f707d                     celery_tasksetmeta_662f707d
celery_taskmeta_id_seq                       celery_tasksetmeta_id_seq
celery_taskmeta_pkey                         celery_tasksetmeta_pkey
celery_taskmeta_task_id_9558b198_like        celery_tasksetmeta_taskset_id_a5a1d4ae_like
celery_taskmeta_task_id_key                  celery_tasksetmeta_taskset_id_key

I have the following installed:

celery-haystack 0.10
celery 3.1.25
django-celery 3.2.1
Django 1.9.13

I have applied all available migration.

Am I missing something?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant