PostgreSQL, get statements of a running transaction
No, you can't do that.  Unless you have very verbose logging turned on (like log_statement=all) and can mine that data out of the server log file.

I think it would be a nice feature to optionally store some limited amount of data (like 4096 bytes, but configurable) of "prior transaction context" for each backend and then exposing it through pg_stat_actvity, and maybe logging it for log_lock_waits or deadlock errors.  But as far as I know there is no active work going on to add such a feature.