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

  • Can you add your OS and the result of select name,setting from pg_settings where name like 'log%'? (pre-answer: no, it doesn't cut the statement based on the query contents) Nov 21 '14 at 12:57

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.