Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k190U-0000WV-Rj for pgsql-general@arkaria.postgresql.org; Thu, 30 Jul 2020 13:54:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k190T-0007vW-Rx for pgsql-general@arkaria.postgresql.org; Thu, 30 Jul 2020 13:54:01 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k18LA-0003pb-Gs for pgsql-general@lists.postgresql.org; Thu, 30 Jul 2020 13:11:20 +0000 Received: from authsmtp91.register.it ([195.110.122.176] helo=authsmtp.register.it) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k18L6-0007Ds-J2 for pgsql-general@postgresql.org; Thu, 30 Jul 2020 13:11:19 +0000 Received: from PADOUE ([94.103.121.169]) by cmsmtp with ESMTPSA id 18L1kzgWX9J0d18L2kF1Z3; Thu, 30 Jul 2020 15:11:13 +0200 X-Rid: olivier.lepretre@noetika.com@94.103.121.169 From: =?utf-8?Q?Olivier_Lepr=C3=AAtre?= To: "'Julien Rouhaud'" , "'Adrian Klaver'" Cc: =?utf-8?Q?'Olivier_Lepr=C3=AAtre'?= , "'pgsql-general'" References: <080c01d665bf$370bfde0$a523f9a0$@gmail.com> <42850458-0e48-cad2-4c89-34296a6f0383@aklaver.com> In-Reply-To: Subject: RE: Track pgsql steps Date: Thu, 30 Jul 2020 15:11:09 +0200 Message-ID: <08c601d66672$e53c0870$afb41950$@noetika.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIHYmrn8+HN87oUYW8Zd4pYx2uGWQIbdnusAYRol9CooPbPEA== Content-Language: fr X-Antivirus: Avast (VPS 200730-0, 30/07/2020), Outbound message X-Antivirus-Status: Clean X-CMAE-Envelope: MS4wfGLRrhKC5K3sxPVUCPy8qer/GKPCdop+2IXqZAHBSdtPIv0bLSNWM+wNaYwyIkjg6xT5dj08PnpgMw+yx8zdLkph5bmt3nGrkBpsLuAeIvjrV08xpMBR REdodma8HZr+CEpXpPL/Wa3oLTKe2vBqmJEhDckNsiQcG5IT/2HnFxvQvN5JRK1x8IKUmKYG2AMQLzqqT7P1w+o+TuIUGBOTY/fNNNqVfu+H4Oq5qD+sh+Wi rUUYj9vPWl/tlzJUT8U5L1iWYK285d1B212opKXYP+NJ1voobrZxpGM3sh0kUnBk List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 isola= tion. Thanks a lot. Olivier -----Message d'origine----- De : Julien Rouhaud Envoy=C3=A9 : jeudi 30 juillet 2020 12:19 =C3=80 : Adrian Klaver Cc : Olivier Lepr=C3=AAtre ; pgsql-general Objet : Re: Track pgsql steps On Wed, Jul 29, 2020 at 7:58 PM Adrian Klaver w= rote: > > On 7/29/20 8:44 AM, Olivier Lepr=C3=AAtre wrote: > > Hi, > > > > I have a rather long pgsql procedure and I would like to detect > > which step is currently executing (subscript 1,2,3=E2=80=A6). Due to > > transaction isolation, it=E2=80=99s 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 =C3=A9lectronique a =C3=A9t=C3=A9 v=C3= =A9rifi=C3=A9e par le logiciel antivirus Avast. https://www.avast.com/antivirus