Search Postgresql Archives

Re: write a sql block which will commit if both updates are successful else it will have to be rolled back

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday, December 7, 2023, arun chirappurath <arunsnmimt@xxxxxxxxx> wrote:

Can someone guide me to "write a sql block which will commit if both updates are successful else it will have to be rolled back"?
would like to explicitly specify both commit and rollback in code..

 I would like to turn off the autocommit then execute the query.

As documented under DO if you make an explicit transaction then execute the DO it cannot have transaction control commands.  If you allow it to “auto-commit’’ then it can.  Though in that case writing either rollback or commit for such a simple linear procedure becomes pointless since a transaction will already commit or rollback appropriately depending on whether the procedure provokes an exception.

David J.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux