Hi I would like to write a trigger that recorded every sql statement under the effected entry. So if it is possible to retrieve the sql statement within a trigger??
You can read a tom command from pg_stat_activity table
postgres=# select query from pg_stat_activity where pid = pg_backend_pid(); +------------------------------------------------------------------+ | query | +------------------------------------------------------------------+ | select query from pg_stat_activity where pid = pg_backend_pid(); | +------------------------------------------------------------------+ (1 row)
But this information is available only for top level query.