When running PostgreSQL or MariaDB/MySQL backends, a query to a non-existent
table will raise a "ProgrammingError". This patch properly catches this error.
Without this patch all management calls to manage.py will lead to an error when
running PostgreSQL or MariaDB as a backend.
1. Fail when the db contains encrypted docs and no password is set.
Previously, this case wasn't detected.
2. Exit with an error instead of showing warnings.
This ensures that we never store docs with different encryption passwords.