django-sql-explorer
django-sql-explorer copied to clipboard
Gracefully handle NotSupportedError during schema introspection
In certain circumstances, a django.db.utils.NotSupportedError can be thrown during schema introspection. If this happens, the exception is unhandled and Django returns a 500 response instead of displaying query results.
To reproduce requires:
- Postgresql running in recovery mode (typically a hot standby server). This can be simulated without a hot standby server
- An unlogged table on the primary (
ALTER TABLE table_name SET UNLOGGED) - Attempt to execute a query (e.g.
SELECT 1) against the standby server and receive a 500 error page
Exception detail:
NotSupportedError
cannot access temporary or unlogged relations during recovery
The issue can be worked around by specifying the affected tables in the EXPLORER_SCHEMA_EXCLUDE_TABLE_PREFIXES setting, but this change makes a workaround unnecessary.
Hi maintainers, does this need any action from my end before it can be reviewed or merged?