id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 25020 Provide/log related args (SQL query, params, proc) with database errors Daniel Hahler nobody "Database errors should provide the SQL query being used (the `sql` and maybe `params` separately), e.g. in case of a `DataError`. `DatabaseErrorWrapper` might just log these as an error, in case the reason is for the exception message not getting too long - but it's probably easier/better to apply this to `CursorWrapper.execute`, `CursorWrapper.executemany` and `CursorWrapper.callproc` (via some specialized context manager, which could be passed in relevant args that should be logged or added to the exception in case of error)? It is annoying to figure out where e.g. some varchar length restriction might come from, and the SQL/params would make it more obvious. While you can log queries with the `django.db logger`, `CursorDebugWrapper` or directly in Postgres, the former (logging queries in general) is noisy (and therefore not useful / usually enabled by default) and logging them in your DB should be abstracted away by Django and might be even not possible, in case you cannot control the DB settings in this regard." New feature new Database layer (models, ORM) dev Normal Accepted 0 0 0 0 0 0