Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW
Date: 2024-08-01 20:34:51
Message-ID: bc3af053909014bb00ea15b03ae3c8a7c003c18a.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 2024-08-02 at 00:13 +0500, Kirill Reshke wrote:
> On Thu, 1 Aug 2024 at 23:27, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> >
> > EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through
> > ExecCreateTableAs(), but does use CreateIntoRelDestReceiver().
>
> EXPLAIN ANALYZE and regular query goes through create_ctas_internal
> (WITH NO DATA case too). Maybe we can simply move
> SetUserIdAndSecContext call in this function?

We need to set up the SECURITY_RESTRICTED_OPERATION before planning, in
case the planner executes some functions.

I believe we need to do some more refactoring to make this work. In
version 17, I already refactored so that CREATE MATERIALIZED VIEW and
REFRESH MATERIALIZED VIEW share the code. We can do something similar
to extend that to EXPLAIN ... CREATE MATERIALIZED VIEW.

As for the August release, the code freeze is on Saturday. Perhaps it
can be done by then, but is there a reason we should rush it? This
affects all supported versions, so we've lived with it for a while, and
I don't see a security problem here. I wouldn't expect it to be a
common use case, either.

Regards,
Jeff Davis

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2024-08-01 20:45:00 Re: can we mark upper/lower/textlike functions leakproof?
Previous Message Daniel Verite 2024-08-01 19:55:55 Re: Support LIKE with nondeterministic collations