How to get cursor query

From: Mikhail <bemewe(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: How to get cursor query
Date: 2015-08-18 08:43:01
Message-ID: 1439887381.37589550@f164.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a long executing query via foreign data wrapper and on the remote server i can see that the query is fetching data from the cursor

=# select application_name, state, query from pg_stat_activity where pid = 15455;
application_name │ state │ query
──────────────────┼────────┼─────────────────────
postgres_fdw │ active │ FETCH 100 FROM c514 Is it possible to get query text corresponding to cursor c514?

One of the solution is to turn statement logging on (found it here http://www.postgresql.org/message-id/1361CEF686657C41A139AD8C3145632B44B33A8F@E2010-MB1.manord.com), but it works if i turn statement logging on before query execution. What can i do in case of connection to the server after the statement was executed?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael H 2015-08-18 09:00:05 Re: [CentOS] persistent change of max_stack_depth
Previous Message Jony Cohen 2015-08-18 06:56:49 Re: First-class Polymorphic joins?