pg_stat_activity - is it possible to decompose a stored procedure further? I got a long running query in pg_stat_activity:

 datid | datname  | pid  | usesysid | usename |   application_name    | client_addr | client_hostname | client_port |         backend_start         |          xact_start           |          query_start          |         state_change          | waiting | state  |                      query                       
-------+----------+------+----------+---------+-----------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+-------------------------------+---------+--------+--------------------------------------------------
 16385 | binstore | 3325 |    16644 | bucardo | bucardo KID (fe8fe10) |             |                 |          -1 | 2015-02-02 23:45:17.133177+00 | 2015-02-03 03:37:45.894859+00 | 2015-02-03 03:37:45.926591+00 | 2015-02-03 03:37:45.926592+00 | f       | active | SELECT * FROM bucardo.bucardo_delta_check($1,$2)
(1 row)


The question is: is it possible to break down this bucardo.bucardo_delta_check stored procedure anyhow to get a notion of what exactly causes this query to run so long? Basically, I need an exact number of line of the SP code executing right now.
No, but given the function is read-only, one can try running it again in the concurrent session and see if the slowdown is reproducible. 

If it is, try running the same queries as this function does manually. You may find them by running \sf+ on the function in psql, or, if you are running Bucardo5, by looking at the schema definition: https://github.com/bucardo/bucardo/blob/master/bucardo.schema