pending triggers error with 'manage.py migrate'

Aaron Conole aconole at bytheb.org
Tue Jun 13 06:12:15 AEST 2017


Hi Stephen,

Stephen Finucane <stephen at that.guru> writes:

> On Mon, 2017-06-12 at 12:53 -0400, Aaron Conole wrote:
>> I'm trying to upgrade an older patchwork instance I have, and it seems
>> to be failing when I do a 'migrate' with the specific error:
>> 
>> django.db.utils.OperationalError: cannot ALTER TABLE
>> "patchwork_series" because it has pending
>> trigger events
>> 
>> I've made sure to update django-filter and django-filters to be up to
>> date, along with Django.  I must have missed a step somewhere, has this
>> been seen before?  Google search was not helpful, and my knowledge of
>> Django is pretty thin.
>
> I'm thinking this is a DB error, rather than something
> Django-specific. Which backend are you using,
> and what migration is is failing on? The full output would be helpful.

Sorry for the terse message.  Here's the full output

[pwuser at mail patchwork]$ python3 ./manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, patchwork, sessions, sites
Running migrations:
  Applying patchwork.0016_series_project...Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
psycopg2.OperationalError: cannot ALTER TABLE "patchwork_series" because it has pending trigger events


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.4/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3.4/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/usr/lib/python3.4/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/lib/python3.4/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/lib/python3.4/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 93, in __exit__
    self.execute(sql)
  File "/usr/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 120, in execute
    cursor.execute(sql, params)
  File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python3.4/site-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
django.db.utils.OperationalError: cannot ALTER TABLE "patchwork_series" because it has pending trigger events

It's using postgres as the back-end (psycopg2 is the provider).
Hopefully this tells you something :)

-Aaron

> Cheers,
> Stephen


More information about the Patchwork mailing list