Queries in pg_stat_activity are truncated?

Solution 1:

ALTER SYSTEM SET track_activity_query_size = 16384;

You will still need to restart the service for that to take effect

Solution 2:

PostgreSQL 8.4 adds the parameter "track_activity_query_size". The value will still be truncated, but you can control at what length.

Solution 3:

An alternative in the extreme case is to use the gdb debugger to attach to the process and print out the query.

See http://darthanthony.wordpress.com/2012/10/11/viewing-running-postgres-queries-and-what-if-they-are-too-long/

gdb [path_to_postgres] [pid]

printf "%s\n", debug_query_string

Solution 4:

you can just enable statement logging in postgresql (log_statement), and check the logs.