Re: Extension pg_trgm, permissions and pg_dump order

From: Noah Misch <noah(at)leadboat(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Färber, Franz-Josef (StMUK) <Franz-Josef(dot)Faerber(at)stmuk(dot)bayern(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Extension pg_trgm, permissions and pg_dump order
Date: 2022-06-16 05:42:18
Message-ID: 20220616054218.GA3980475@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

On Sun, Jun 12, 2022 at 08:45:51PM -0700, Noah Misch wrote:
> On Wed, Jun 08, 2022 at 10:17:08PM -0700, Noah Misch wrote:
> > On Sun, Jun 05, 2022 at 11:30:56PM -0700, Noah Misch wrote:
> > > On Fri, Jun 03, 2022 at 11:17:24AM -0700, Nathan Bossart wrote:
> > > > On Tue, May 31, 2022 at 08:28:55AM -0700, Nathan Bossart wrote:
> > > > > I've spent some time looking at all the code impacted by a117ceb and
> > > > > 0abc1a0, and I've yet to identify any additional problems besides the one
> > > > > with ResolveOpClass(). However, I'm far from confident in this analysis,
> > > > > and I still need to try out the ereport() approach that Noah suggested. I
> > > > > would welcome any assistance identifying other problem areas.
> > > >
> > > > Ah, I think I am missing something. For example, the code that identifies
> > > > the exclusion operator (immediately following the call to ResolveOpClass())
> > > > is likely subject to a similar problem.
> > >
> > > That would not surprise me. Do you have what you need to continue?
> >
> > I'll use that window on Sunday to review what you have. If you have work in
> > progress, please get it to the mailing list by then.
>
> I have the patch mostly done. I will send something late on Wednesday.

I also found post-202205 CREATE INDEX reaching an improper "permission denied"
for the namespace containing a collation. The attached version fixes and
tests all three improper denials. Also, I added discards of GUC changes
before switching to the original userid. Without those, an index expression
changing search_path affects the collation lookup. Unfortunately, this is
making ComputeIndexAttrs() look like an unplanned mess. I considered two
alternatives:

1. Move all "List *names -> oid" translation activities from
ComputeIndexAttrs() to transformIndexStmt(). I ruled this out for a
back-patched fix, because such a change would tend to break compatibility
with the PGXN modules that call transformIndexStmt() or DefineIndex(). It
might be a good long-term direction, though the note in the header of
transformIndexStmt() gives another obstacle.

2. Move all "List *names -> oid" translation activities from
ComputeIndexAttrs() to DefineIndex(), before table_open(). There's nothing
ruling out this option, but I ran out of time to try it. It would be weird
to have per-attribute logic in both DefineIndex() and ComputeIndexAttrs(),
so I'm skeptical about this helping.

For partitioned tables, it would add good defense-in-depth to perform the
"List *names -> oid" translations once per SQL statement, not once per
partition as has been the case. (1) would move in that direction.

Thanks,
nm

Attachment Content-Type Size
create-index-non-opaque-acl-v4nm.patch text/plain 17.5 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marco Boeringa 2022-06-16 06:10:12 "SELECT COUNT(*) FROM" still causing issues (deadlock) in PostgreSQL 14.3?
Previous Message Kyotaro Horiguchi 2022-06-16 03:07:47 Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

Browse pgsql-general by date

  From Date Subject
Next Message Bryn Llewellyn 2022-06-16 06:07:47 Re: ERROR: failed to find conversion function from key_vals_nn to record[]
Previous Message David G. Johnston 2022-06-16 03:13:42 Re: ERROR: failed to find conversion function from key_vals_nn to record[]