Re: Force Commit

From: Andrei Zhidenkov <andrei(dot)zhidenkov(at)n26(dot)com>
To: İlyas Derse <ilyasderse(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Force Commit
Date: 2020-02-05 09:22:09
Message-ID: FF57F57D-EA81-46CA-9776-1BAD1CCB85F4@n26.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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..

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Satheesh-Gsuite 2020-02-05 09:22:51 Read: The best way to solve a problem
Previous Message Sonam Sharma 2020-02-05 08:47:57 Re: Restore is failing