Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Get session id of opened cursor in PostgreSQL

In Oracel V$OPEN_CURSOR include a sid field, but the pg_cursors table in Postgres has no connection with other system catalogs. Is it possible to get such information in PostgreSQL? If i clearly understand, there are no session ids in PostgreSQL and usualy using backend pid. I have get a list of tables with opened cursors, but it can not help me, because there is no connection between pg_tables and pg_stat_activity.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In PostgreSQL, a cursor only exists in and for the current database connection. So the session that can use a cursor is always only the one that opened it. You can see all open cursors of the current session in the view pg_cursors. Since this information is not stored in shared memory, there is no way to see the cursors for a different database connection.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading