I am using PostgreSQL 9.6.
I have a PROCEDURE in sql server. That makes use of a try catch block. It looks a little bit like the code below:
BEGIN TRANSACTION
BEGIN TRY
--do stuff here
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
--do error stuff here
END CATCH
Upon doing some research, It seems like postgres does not make use of try catch. Is there some way to handle this in postgres the same way sql server does?
BEGIN ... EXCEPTION ... ENDin PL/pgSQL. But you cannot commit in a function. - Laurenz Albe