Re: Force Commit - Mailing list pgsql-general

From Andrei Zhidenkov
Subject Re: Force Commit
Date
Msg-id FF57F57D-EA81-46CA-9776-1BAD1CCB85F4@n26.com
Whole thread Raw
In response to Force Commit  (İlyas Derse <ilyasderse@gmail.com>)
List pgsql-general
You can workaround by simulation autonomous transaction using plpython or dblink. Or just performing a commit outside the stored procedure.

On 5. Feb 2020, at 09:06, İlyas Derse <ilyasderse@gmail.com> wrote:

I'm writing to you about  Commit. I want to do force commit query even if  I have exception.
It's like :

CREATE OR REPLACE PROCEDURE public."test"()
LANGUAGE 'plpgsql'
AS $BODY$
DECLARE "a" integer  ;
DECLARE "b" integer  ;
BEGIN    
"a" = 1;
"b" = 0;
   BEGIN  
   raise notice 'hata';
   update public."crud" set lastname = 'Tekindor' where autoid = 20;
   "a"="a"/"b";
   ROLLBACK;

  EXCEPTION
  WHEN OTHERS THEN

   COMMIT;
  END ;
END ;
$BODY$;

How can I do force commit  ? 
Thanks..

pgsql-general by date:

Previous
From: Sonam Sharma
Date:
Subject: Re: Restore is failing
Next
From: "Satheesh-Gsuite"
Date:
Subject: Read: The best way to solve a problem