I am handling a very annoying problem when attempting to operate DJ tests for any project on PostgreSQL after sales. It begins running the tests so when the very first DB flush should happen it fails having a strange error:

..Error: Database dbname couldn't be flushed. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the expected database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.
The full error: cannot TRUNCATE "table_name" because it has pending trigger events

Basically run the creation of sqlflush through pgAdmin, it runs all right.

Any ideas are welcome for possible causes.

Update:

OK, appears like this isn't really an issue from Django, rather it's associated with the exam runner from djangosanetesting. With default DJ test runner or django-nose test runner it really works.

OK, appears like this isn't really an issue from Django, rather it's associated with the exam runner from djangosanetesting, that eliminating appears to become damaged in some manner. For the time being I do not possess a better solution than simply using django-nose test runner.