Jeff Davis <jdavis@wasabimg.com> writes:
> How can I conveniently handle output from an EXPLAIN query inside an
> application? It appears to just immediately send the output to the stdout of
> whatever program uses it. Is there a way to get the output inside a program,
> with libpq or otherwise?
The EXPLAIN result is sent as a NOTICE message, so you can trap it by
setting libpq's notice processor function --- see PQsetNoticeProcessor.
regards, tom lane