Qingqing Zhou <zhouqq.postgres@gmail.com> writes:
> Not sure if I got it: so EXPLAIN will return tuples to libpq client. But
> how do we store these returned tuples (RelOptInfo, Path etc) so we can
> throw queries against them later?
> Something like this:
> INSERT INTO my_space SELECT (EXPLAIN SELECT ...); -- won't get parsed
You can do something like that in plpgsql, for example
declare t text;
for t in EXPLAIN SELECT ... loop insert into whatever values(t); end loop;
There's an example of doing this sort of thing in the brin.sql regression
test, where it's used to verify that we're getting the plan type we
expect.
I don't feel a strong need to invent additional forms of that wheel.
regards, tom lane