Re: add queryEnv to ExplainOneQuery_hook

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Tatsuro Yamada <yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: add queryEnv to ExplainOneQuery_hook
Date: 2018-01-11 11:43:22
Message-ID: CAEepm=1-tK4q9UA7RyD+HTCZrH+JV4pJ-1b-7L2QUQh6TbpuKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 12, 2018 at 12:16 AM, Tatsuro Yamada
<yamada(dot)tatsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> I found a variable (queryEnv) which should be added in
> ExplainOneQuery_hook because if it is missing, hook function
> can't call ExplainOnePlan.
> Sorry if this wasn't correct.
>
> Please find attached a patch.

Yeah, I think you're right. That's an oversight in 18ce3a4a. I'm
surprised we haven't heard any complaints sooner if there are advisors
using that hook[1] and expecting to be able to forward to
ExplainOnePlan(), but I suppose it would nearly always works to call
ExplainOnePlan() with NULL as queryEnv. It'd currently only be
non-NULL for trigger functions running SQL to access transition
tables, which is a bit obscure: you'd need to run EXPLAIN inside a
suitable trigger function (though in future there might be more ways
to create named tuplestore relations).

[1] https://www.postgresql.org/message-id/20161113222804.o2uw7c2fish67iej%40alap3.anarazel.de

--
Thomas Munro
http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2018-01-11 11:56:50 Re: CUBE seems a bit confused about ORDER BY
Previous Message Tatsuro Yamada 2018-01-11 11:16:27 add queryEnv to ExplainOneQuery_hook