Re: Clarification on Role Access Rights to Table Indexes

From: Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clarification on Role Access Rights to Table Indexes
Date: 2025-03-08 15:04:40
Message-ID: CACX+KaO4R9QDxbPSxSB0jNXFsqA6Jf=UPS+tyUvT_YvuP_grVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> I'm wondering whether setting missing_ok to true is correct here. IIUC we
> should have an AccessShareLock on the index, but I don't know if that's
> enough protection.

Since we are already opening the relation with rel = relation_open(relOid,
AccessShareLock);,
if relOid does not exist, it will throw an error. If it does exist, we
acquire an AccessShareLock,
preventing it from being dropped.

By the time we reach IndexGetRelation(), we can be confident that relOid
exists and is
protected by the lock. Given this, it makes sense to keep missing_ok = false
here.

Let me know if you agree or if you see any scenario where
missing_ok = true would be preferable—I can update the condition
accordingly.

Thanks!
Ayush Vatsa
SDE AWS

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rhys A.D. Stewart 2025-03-08 19:01:04 exclusion constraint question
Previous Message Greg Sabino Mullane 2025-03-08 03:34:22 Re: No. Of wal files generated

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2025-03-08 15:06:38 Re: pg_atomic_compare_exchange_*() and memory barriers
Previous Message Andres Freund 2025-03-08 13:41:24 Re: pg_atomic_compare_exchange_*() and memory barriers