﻿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
32248	QuerySet.get() leaves postgres in 'current transaction is aborted...' state if invalid data is passed.	Asit Kumar Singh	Nayan sharma	"calling get_object_or_404() with invalid data (e.g. invalid UUID) in any of the fields causes Postgres to stay in the same transaction. On Postgres, this leads to the failure of any new query using the same connection. The reason for this is Postgres on getting invalid input doesn't rollback the transaction automatically and neither does Django explicitly rollbacks such get calls, which leaves the database in an unstable state.
Example code: 
{{{
     def invalid_data(model):
          try:
                 obj=get_object_or_404(model, id=f""{invalid_data}"")
          except:
                 # do something
         model.objects.first().field # this will fail with current transaction is aborted error.
          
}}}
"	Bug	closed	Database layer (models, ORM)	2.2	Normal	invalid	postgres transaction_aborted get_object_or_404	Asit Kumar Singh	Unreviewed	0	0	0	0	0	0
