From: Olivier Leprêtre <Olivier.Lepretre@noetika.com>
To: 'Julien Rouhaud' <rjuju123@gmail.com>
To: 'Adrian Klaver' <adrian.klaver@aklaver.com>
Cc: 'Olivier Leprêtre' <o.lepretre@gmail.com>
Cc: 'pgsql-general' <pgsql-general@postgresql.org>
Subject: RE: Track pgsql steps
Date: Thu, 30 Jul 2020 15:11:09 +0200
Message-ID: <08c601d66672$e53c0870$afb41950$@noetika.com> (raw)
In-Reply-To: <CAOBaU_Ze2sTDZBRt=xaT6YLj0BXSBmy0L5C1es5nT2VDPS9U-Q@mail.gmail.com>
References: <080c01d665bf$370bfde0$a523f9a0$@gmail.com>
<42850458-0e48-cad2-4c89-34296a6f0383@aklaver.com>
<CAOBaU_Ze2sTDZBRt=xaT6YLj0BXSBmy0L5C1es5nT2VDPS9U-Q@mail.gmail.com>
Hi, thanks for your answers,
Application_name is a good tip, 64 chars are enough to code steps, I'll use that
I expected being able to write raise events to a table or to store data in another table but it doesn't appear to be possible due to transaction isolation.
Thanks a lot.
Olivier
-----Message d'origine-----
De : Julien Rouhaud <rjuju123@gmail.com>
Envoyé : jeudi 30 juillet 2020 12:19
À : Adrian Klaver <adrian.klaver@aklaver.com>
Cc : Olivier Leprêtre <o.lepretre@gmail.com>; pgsql-general <pgsql-general@postgresql.org>
Objet : Re: Track pgsql steps
On Wed, Jul 29, 2020 at 7:58 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> On 7/29/20 8:44 AM, Olivier Leprêtre wrote:
> > Hi,
> >
> > I have a rather long pgsql procedure and I would like to detect
> > which step is currently executing (subscript 1,2,3…). Due to
> > transaction isolation, it’s not possible to make it write in a table
> > or get nexval from a sequence because values become available only
> > after the complete end of the procedure.
> >
> > Do you see any solution in this purpose ?
>
> RAISE NOTICE?:
>
> https://www.postgresql.org/docs/12/plpgsql-errors-and-messages.html#PL
> PGSQL-STATEMENTS-RAISE
You can also abuse SET application_name, as the value will be directly seen by other transactions. You're quite limited in the number of bytes to use, but if you just need to do some quick testing it can be helpful.
--
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: Olivier.Lepretre@noetika.com, rjuju123@gmail.com, adrian.klaver@aklaver.com, o.lepretre@gmail.com
Subject: Re: Track pgsql steps
In-Reply-To: <08c601d66672$e53c0870$afb41950$@noetika.com>
References: <080c01d665bf$370bfde0$a523f9a0$@gmail.com> <42850458-0e48-cad2-4c89-34296a6f0383@aklaver.com> <CAOBaU_Ze2sTDZBRt=xaT6YLj0BXSBmy0L5C1es5nT2VDPS9U-Q@mail.gmail.com> <08c601d66672$e53c0870$afb41950$@noetika.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox