From: Nathan Bossart <nathandbossart@gmail.com>
To: Jeff Davis <pgsql@j-davis.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ayush Vatsa <ayushvatsa1810@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Clarification on Role Access Rights to Table Indexes
Date: Thu, 9 Oct 2025 10:39:32 -0500
Message-ID: <aOfXNAFkj_EFm-8q@nathan> (raw)
In-Reply-To: <7b0e2774cdcc8f522ac82f64a8d7266f353a5094.camel@j-davis.com>
References: <Z8y9RTT-vU6oVI_Y@nathan>
<149429.1741472260@sss.pgh.pa.us>
<Z8zwVmGzXyDdkAXj@nathan>
<279947.1741535285@sss.pgh.pa.us>
<Z88CB-vDehJ9rW8u@nathan>
<aNQVIVKarUipPcnW@nathan>
<3432170.1758730414@sss.pgh.pa.us>
<aNQhuRQfD3PlpeuT@nathan>
<8af53c6e8992aa706e63aafe60a3bcf100b524d1.camel@j-davis.com>
<7b0e2774cdcc8f522ac82f64a8d7266f353a5094.camel@j-davis.com>
On Wed, Oct 08, 2025 at 08:28:01PM -0700, Jeff Davis wrote:
> Actually, now I'm unsure. v4-0001 is taking a lock on the table before
> checking privileges, whereas v4-0002 is going to some effort to avoid
> that. Is that because the latter is taking a ShareLock?
I was confused by this, too. We seem to go to great lengths to avoid
taking a lock before checking permissions in RangeVarGetRelidExtended(),
but in pg_prewarm() and this stats code, we are taking the lock first.
pg_prewarm() can't use RangeVarGetRelid because you give it the OID, but
I'm not seeing why stat_utils.c can't use it. We should probably fix this.
I wouldn't be surprised if there are other examples.
--
nathan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: nathandbossart@gmail.com, pgsql@j-davis.com, tgl@sss.pgh.pa.us, ayushvatsa1810@gmail.com, robertmhaas@gmail.com, david.g.johnston@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: Clarification on Role Access Rights to Table Indexes
In-Reply-To: <aOfXNAFkj_EFm-8q@nathan>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox