You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# some scriptfromdjango.dbimporttransaction, IntegrityErrorUser.objects.create(name='bob')
try:
withtransaction.atomic():
User.objects.create(name='bob')
exceptIntegrityErroraserr:
print("tried to create a duplicate!")
Since I've just created two users with the same name, I would expect IntegrityError to be raised and the print statement to be executed. Instead the error django.db.InternalError is raised with message current transaction is aborted, commands ignored until end of transaction block.
This indicates something tried to use the DB connection again after the transaction with broken (IntegrityError occured). Silky is unfortunately the one doing this; after the query fails the finally block here re-uses the same DB connection to explain the query which causes the InternalError to be raised instead of IntegrityError.
The text was updated successfully, but these errors were encountered:
Example:
Since I've just created two users with the same name, I would expect
IntegrityError
to be raised and the print statement to be executed. Instead the errordjango.db.InternalError
is raised with messagecurrent transaction is aborted, commands ignored until end of transaction block
.This indicates something tried to use the DB connection again after the transaction with broken (
IntegrityError
occured). Silky is unfortunately the one doing this; after the query fails thefinally
block here re-uses the same DB connection to explain the query which causes theInternalError
to be raised instead ofIntegrityError
.The text was updated successfully, but these errors were encountered: