Re: MAINTAIN privilege -- what do we need to un-revert it?

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: Nathan Bossart <nathandbossart@gmail.com>, Yugo NAGATA <nagata@sraoss.co.jp>
Cc: Noah Misch <noah@leadboat.com>, Michael Paquier <michael@paquier.xyz>, pgsql-hackers@postgresql.org, Joe Conway <mail@joeconway.com>, Robert Haas <robertmhaas@gmail.com>
Date: 2024-09-27T16:22:48Z
Lists: pgsql-hackers
On Fri, 2024-09-27 at 10:34 -0500, Nathan Bossart wrote:
> On Fri, Sep 27, 2024 at 12:42:34PM +0900, Yugo NAGATA wrote:
> > I agree with you. I overlooked WITH NO DATA.
> > I attached a updated patch.
> 
> Thanks.  Unless someone objects, I plan to commit this shortly.

The command is run effectively in two parts: the CREATE part and the
REFRESH part. The former just uses the session search path, while the
latter uses the safe search path.

I suggest that we add the wording to the
<replaceable>query</replaceable> portion of the doc, near "security-
restricted operation".

Regards,
	Jeff Davis




Commits

  1. doc: Note that CREATE MATERIALIZED VIEW restricts search_path.

  2. Small refactoring around ExecCreateTableAs().

  3. Add is_create parameter to RefreshMatviewByOid().

  4. Remove unused ParamListInfo argument from ExecRefreshMatView.

  5. When creating materialized views, use REFRESH to load data.

  6. Add missing RestrictSearchPath() calls.

  7. Fix search_path to a safe value during maintenance operations.

  8. Revert MAINTAIN privilege and pg_maintain predefined role.

  9. Avoid repeated name lookups during table and index DDL.

  10. Add a materialized view relations.