Re: Track pgsql steps

From: Diego <mrstephenamell(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Track pgsql steps
Date: 2020-07-30 14:03:24
Message-ID: 0d1358d6-61fd-d79b-51ab-7b4177584ad3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

are you running the psql with -c or -f?

add -o to put all in a file and -e to write the last query, and with a
tail to the log, you can see where is the problem

On 2020-07-30 10:11, Olivier Leprêtre wrote:
> 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(at)gmail(dot)com>
> Envoyé : jeudi 30 juillet 2020 12:19
> À : Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
> Cc : Olivier Leprêtre <o(dot)lepretre(at)gmail(dot)com>; pgsql-general <pgsql-general(at)postgresql(dot)org>
> Objet : Re: Track pgsql steps
>
> On Wed, Jul 29, 2020 at 7:58 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-07-30 14:26:45 Re: PSQLException: An I/O error occurred while sending to the backend.
Previous Message FOUTE K. Jaurès 2020-07-30 13:54:08 Questions about Logical Replication - Issue ???