Postgresql – SQL Statements truncated in log files

postgresql

Does PostgreSQL cut statements if there is a subselect in it?

We use log_min_duration_statement = 20ms to find statements which need a long time.

But unfortunately the statements are truncated:

2014-11-20 14:09:25 CET foo3_egs_p foo3_egs_p [22106] LOG:  duration: 99210.696 ms  statement: SELECT "foo3_ticket"."tickettype_id", "foo3_tickettypegroup_tickettypeen"."tickettypegroup_id", "foo3_tickettype"."ordner_id", COUNT("foo3_ticket"."id") AS "pk__count" FROM "foo3_ticket" INNER JOIN "foo3_tickettype" ON ("foo3_ticket"."tickettype_id" = "foo3_tickettype"."id") LEFT OUTER JOIN "foo3_tickettypegroup_tickettypeen" ON ("foo3_tickettype"."id" = "foo3_tickettype group_tickettypeen"."tickettype_id") WHERE ((

The line ends with WHERE ((.

That's sad, because I would like to copy the statement to debug it with EXPLAIN ANALYZE

Why does the above statement get truncated? Any way to get the whole statement?

This is a legacy environment with PostgreSQL 9.1.2

Best Answer

Answer to own question: I was blind. The statements are not truncated, but they contain newlines. There was some pre preprocessing done before I looked at them. And this preprocessing was done lines based, so they looked like being cut.