Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tqvkW-00CFX2-D0 for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Mar 2025 15:06:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tqvjU-002ABb-Sn for pgsql-hackers@arkaria.postgresql.org; Sat, 08 Mar 2025 15:04:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tqvjU-002A7e-Dn for pgsql-hackers@lists.postgresql.org; Sat, 08 Mar 2025 15:04:56 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tqvjQ-001hMs-2N for pgsql-hackers@postgresql.org; Sat, 08 Mar 2025 15:04:56 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5dc89df7eccso4658213a12.3 for ; Sat, 08 Mar 2025 07:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741446292; x=1742051092; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=DsK3P5IsFCJ5E3RLMcJzw52RSlDDIYRZJnmHVFtt7Is=; b=WuHfkzB0DWOZP5wXk9RVrl8k1ON8oPdO9u4bNgsxl6Lnop4+g7TRWeamVV0wrbKRJb 700EicvDAEfZU/pggq8W0xTu2nuvoabxQcfg4hDng5cOxTbhAycxcRMktweiaFxp7d+g KVDsHOJRkGSnw8+2xtfKRXbuVBrTSDrDpACWOKOPsPFPTFkYGLp1KC8cejvUIlHRn/kY FpKVskhIohDz14emxNR62rcpWZgqm5xok02g4EhSxpl1L+pgggRCHCQ9vec6OSoJtb3g +/Uj9y9trbQjkov1p8vVPl15DdowWWTQYxbAR14kd8U86i5vi55bj8kjinkycTXCTNgK yLpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741446292; x=1742051092; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DsK3P5IsFCJ5E3RLMcJzw52RSlDDIYRZJnmHVFtt7Is=; b=VB9vuf5KjUa04OFx4j6pG72NwnEAbzYZP/TYkvVH0OA4NeqNg8Gq/oHLRA/b0m7Brp 1MwIDkT+IC/hxRGYDqQm7mudBLLn67sqFPv3fBR2tZmJSML6MVQ4lnp/fuE8PeGksBi8 pBE7FQGwKjVZFMa39LMJVv8QGV9+Q4yJYSlYfTdIKI/7JJ5eSvUW+ZBewehQ7noZd0/R 9AfFL7wXdk14XQrxuaXuEaMa8crXakJGZVCioODfdlbwIHGP80h7dQxqqjRllHczo3Hm Q/QVCeg8lloouiuTox28qV+ES4wC0/an2a5tOZu1vWInYx4lEEsCy6C1gGq4KF6wsxFj kBIQ== X-Forwarded-Encrypted: i=1; AJvYcCWIFQ36iIrVr66trOeDwDiU9UuqqbWasZVKygV3OzhSeUYOHVU/+zcP6pF1IyW0CKyaPCKxpAn0N0D1EZFl@postgresql.org X-Gm-Message-State: AOJu0YwRQOEbsREPtzPptGLHtlzRDdicu1kI35XObQFDzqJCEA3ukeo2 0Dcj0+8qSH55DqO9pcTpbW3dUd/rozOzbhRon0MbjIpUS2oOpgL4xNQCOnH5uNGGamr5uaUzEUn 8DysQnWRSr3szkFr7OO8q7X7FYuo= X-Gm-Gg: ASbGncsluKYH81l9VneoPLj8jgmtVHkiCNpRWcg7fcCVd5Fh4ENjBsPxLHA9Qj/2KS1 PuljmZcjUXDxyg+RzPlJ+d1TmcfPAkAMbmVOP/5QZVoufGFzSw5tygB3p2iRu+cu2WDAT1UgUqh 83T97xWEYnbUMtWObLsvY7dw== X-Google-Smtp-Source: AGHT+IGcYFO91DBd8DTAiak0PWyFE99f3fEj+9v5rtLuMJ3LKlDKqdiN+bLj/QkDeVF05UvPMghccQpEJvQcpwlmO50= X-Received: by 2002:a05:6402:4309:b0:5e6:44c8:e849 with SMTP id 4fb4d7f45d1cf-5e644c8e943mr782095a12.15.1741446291727; Sat, 08 Mar 2025 07:04:51 -0800 (PST) MIME-Version: 1.0 References: <934709.1739829723@sss.pgh.pa.us> <1243984.1739894558@sss.pgh.pa.us> <1246906.1739896202@sss.pgh.pa.us> In-Reply-To: From: Ayush Vatsa Date: Sat, 8 Mar 2025 20:34:40 +0530 X-Gm-Features: AQ5f1Jr6ix_WackRXeznfk58e8Vb-iANmN9ujDNbfEAmYHaE4-bqOPkJwD_0fFQ Message-ID: Subject: Re: Clarification on Role Access Rights to Table Indexes To: Nathan Bossart Cc: Robert Haas , Tom Lane , "David G. Johnston" , PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000009d2eee062fd60f46" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009d2eee062fd60f46 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > I'm wondering whether setting missing_ok to true is correct here. IIUC w= e > 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 =3D 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 =3D fa= lse here. Let me know if you agree or if you see any scenario where missing_ok =3D true would be preferable=E2=80=94I can update the condition accordingly. Thanks! Ayush Vatsa SDE AWS --0000000000009d2eee062fd60f46 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> I'm wondering whether setting missing_ok to true = is correct here.=C2=A0 IIUC we
> should have an AccessShareLock on th= e index, but I don't know if that's
> enough protection.=C2= =A0

Since we are already opening th= e relation with rel =3D relation_open(relOid, AccessShareL= ock);,
if relOid does not exist, it will= throw an error. If it does exist, we acquire an AccessSha= reLock,
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 =3D false= here.

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

Thanks!
Ayush Vatsa
SDE A= WS

--0000000000009d2eee062fd60f46--