See the definition of a cursor
Use the pg_catalogs.pg_cursors view.

postgres=# BEGIN;
BEGIN
postgres=# DECLARE "db" CURSOR FOR SELECT * FROM book_lines;
DECLARE CURSOR
postgres=# SELECT * FROM pg_cursors ;
 name |                     statement                     | is_holdable | is_binary | is_scrollable |         creation_time         
------+---------------------------------------------------+-------------+-----------+---------------+-------------------------------
 db   | DECLARE "db" CURSOR FOR SELECT * FROM book_lines; | f           | f         | t             | 2016-03-05 21:17:01.565456+08
(1 row)


Note that it shows the whole statement defining the cursor, not just the query that underlies the cursor. I don't know of any way to get just the cursor's query, so you'd probably have to do text processing to get that.