Opened 2 years ago

Closed 2 years ago

#33741 closed Bug (invalid)

Transaction Management inside PROCEDURE

Reported by: Victor Vieux Owned by: nobody
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords: database procedure transaction
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

Hello,

I have a PROCEDURE that uses Transaction Management from postgres (meaning there are COMMITs inside the procedure itself)
It runs fine in postgres, but when trying to invoke it from django either via

with connection.cursor() as c:
    c.execute(...)

or

cursor.callproc

I get the following error:

django.db.utils.InternalError: invalid transaction termination
CONTEXT:  PL/pgSQL function xxx() line xx at COMMIT

I think that's because when executing raw queries with execute, they are run inside a transaction?
Is there a way to bypass this?

Thanks.

Change History (1)

comment:1 by Tim Graham, 2 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Please see TicketClosingReasons/UseSupportChannels for places to ask usage questions.

Note: See TracTickets for help on using tickets.
Back to Top