Teach contrib/pg_stat_statements to handle multi-statement commands better.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 14 Jan 2017 21:17:30 +0000 (16:17 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 14 Jan 2017 21:17:30 +0000 (16:17 -0500)
commit83f2061dd037477ec8479ee160367840e203a722
treee9ad77cf2382728eaa729e2c385016a294f00639
parentab1f0c8225714aaa18d2f9ca4f80cd009f145421
Teach contrib/pg_stat_statements to handle multi-statement commands better.

Make use of the statement boundary info added by commit ab1f0c822
to let pg_stat_statements behave more sanely when multiple SQL queries
are jammed into one query string.  It now records just the relevant
part of the source string, not the whole thing, for each individual
query.

Even when no multi-statement strings are involved, users may notice small
changes in the output: leading and trailing whitespace and semicolons will
be stripped from statements, which did not happen before.

Also, significantly expand pg_stat_statements' regression test script.

Fabien Coelho, reviewed by Craig Ringer and Kyotaro Horiguchi,
some mods by me

Discussion: https://postgr.es/m/alpine.DEB.2.20.1612200926310.29821@lancre
contrib/pg_stat_statements/expected/pg_stat_statements.out
contrib/pg_stat_statements/pg_stat_statements.c
contrib/pg_stat_statements/sql/pg_stat_statements.sql