Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW - Mailing list pgsql-hackers

From Jeff Davis
Subject Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW
Date
Msg-id 20444c382e6cb5e21e93c94d679d0198b0dba4dd.camel@j-davis.com
Whole thread Raw
Responses Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW
Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW
List pgsql-hackers
EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through
ExecCreateTableAs(), but does use CreateIntoRelDestReceiver().

That bypasses the SECURITY_RESTRICTED_OPERATION in ExecCreateTableAs().
That is *not* a security problem, because the
SECURITY_RESTRICTED_OPERATION in CREATE MATERIALIZED VIEW is merely for
consistency with a later REFRESH MATERIALIZED VIEW command where the
SECURITY_RESTRICTED_OPERATION is important.

But it is inconsistent. For example:

  create or replace function set() returns int
    language plpgsql as $$
      begin
        create temp table x(i int);
        return 42;
      end;
    $$;
  create materialized view mv1 as select set(); -- fails
  explain analyze
    create materialized view mv1 as select set(); -- succeeds

Relatedly, if we can EXPLAIN a CREATE MATERIALIZED VIEW, perhaps we
should be able to EXPLAIN a REFRESH MATERIALIZED VIEW, too?

Comments?

Regards,
    Jeff Davis




pgsql-hackers by date:

Previous
From: "Euler Taveira"
Date:
Subject: Re: rare crash - FailedAssertion snapbuild.c Line: 580
Next
From: Jeff Davis
Date:
Subject: Re: MAINTAIN privilege -- what do we need to un-revert it?