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.96) (envelope-from ) id 1w7ERD-00562c-0Y for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 15:21:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7ERB-004Kbf-1m for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 15:21:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7ERB-004KbV-0s for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 15:21:57 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7ER9-00000001p7Z-3drl for pgsql-hackers@postgresql.org; Mon, 30 Mar 2026 15:21:56 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43cf5fbacc9so992668f8f.1 for ; Mon, 30 Mar 2026 08:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774884114; cv=none; d=google.com; s=arc-20240605; b=WnYvGva6bxjyjQtBO00yFremEJ6ylDhogpgD/pcypAmigPfXaUJz8Bmd8pLTWZce0I NWlleNEO+dTBwFqhVpnarnozGub79uHsdN/CZCKLWB6S8rG8XKX2XsxoH7MUW8LHraOz qyJ0xkQRgel48ukcSulSP53BEG5JEY/2s7zSUGHAAQ4B/G0MjxKHTK6RGRM83sK6ys+h XDTlZ4RKpaI5dZoIIR6+s+RsMGej8CBeQDA6AYJm4kfwtIJVnea6jzYEk7LLlgOBv/HV 04wPCJffM6o1Y44WQuMJg+LTH0VSFPK/jFQKTOUhOhyYVaj3Le9aSwRqRc0pu/TMnwis c/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=TGf1gdgo1snnf6AJxtaLT1xLiN5zBYP/1GBARf619Hs=; fh=zoRFi4vqyblac5YGSUJxae8nhQ5jpL9RmI3ky3M0sTQ=; b=CwyIlxmZSgP2rb8PkGNFrIV0qTnKk5bopsawDGhAylI98dFBpQ0Iyi0kE4MigA6Uap RIPQwVUsz3bH+dj+iyYeyukeJQgih9TxqPE7gSVRVZHWoUmkj4Or2MtRK/8n5iDhJmlS 1skfoq80PGyEQiVOzm5lh7K52UbFR0gdezdmkDr1sTNEFFpw4fZLQB4kTyy7M/Tczo2B bC7MyRK15h6WuFxg5sy8TU/yrBlN+bMj7DIxT784j7yTadzD81SqHfsBolxAtoM+aX9M nR2LUcxa4uezAx/Lzp+41cgoq7LvqMB27z6OZftFvbm/6f01gpI8flhvPLaiC1FAHZow 75Ew==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774884114; x=1775488914; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TGf1gdgo1snnf6AJxtaLT1xLiN5zBYP/1GBARf619Hs=; b=V3fCh+9lUYvjlHUtOyvZACvZuXf5LcQ80N/M1mZr4RT+DCSkPPiOalbLubvOw6Whkn tXrobJKI++5ODrLhWBVQfVoLc4own5RR0yn1AkPPRHJtAag6jWV5FzFZB6b+iYq94Ibt bVauusBQwnWt9d96Pp754kObku9UDAoRaIf7Cd3fROnuyZJCHWPx56LQ2fMJMO61SdK/ MXePqOeZKb1u4Y1WH0RgZs2H6x31QBdK/8H6ctIKh6Fho87ZZgZY0rIt2bx5wbncaTv4 auWLDJg4JFQRttjbaicAt15nXZtoJoUXcYmEpRlcCSOY7o18t/+BiOGPRkrexVPuyok6 0F0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774884114; x=1775488914; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TGf1gdgo1snnf6AJxtaLT1xLiN5zBYP/1GBARf619Hs=; b=T7ewR2nWDLvQBxa9xj8R0cC8I5BWUEixAh18sGAKSi5/sLdBGTt/HoQ1E7Hv8x01vn 2yyGFfwiQlgrwc59qjdbcTRHaLfWOBuO2Tt4ribcN/RtmAJXs/z/kVUCxErEsVkN9mKQ 8MlsbByh2AjHkHnd1LDvqYc5opClt79RyD3tMGGFiX1ipCNLT37ywmk/PuqxIu/2svHO xlhJs82dqdj5HmaIj8OVAQsdpV+Q5nkX4CuZRhw8pPT9hsD9Ns9cyV84lIuQ9BZUtPkS lpp3fmcsp3pD4hjxudwy0r76kDrvqKoxwmWaOpH8DS2/BieSak+pPnuxV/Hvx1UXL7lm +BBA== X-Gm-Message-State: AOJu0Yzckx8nGvQCDt+qY5NX1Fgzo1o4GmbyGEiZ3IXle+42Qs6JllUE xUEwsBH9OE0T+y/8qTmW0dGJ1iBH17gz5zABD8bHm/DQ6MV2a4KeW7yTY7MoTnt6tR9cq7K+BGU evjJiAOLKYsJtx2I6+aPxSoZLcU4oRfQtvvw3 X-Gm-Gg: ATEYQzwzd7X3pimr2U4YMxNkg1W5TW3aXVMG1R1TdDmFlHlvWOIqh3qUxttVlOw10NQ IHmANfNU2fd/puQk9RwLdiVUVfhM+cjvxB/3SJh667HWJlZ0u84lXc4ecpoPeT7NZ+8V7H7YpqB ezGFftSoGFPxDTBhyUZyDSq7Y8Lnc71IDlHhcC9murZYn5a7w7hODs/Muh6JnIYqpN66uNcTT9f 7ganqr8anzJLVFy5yHinlCtBDLk2nBfFscuS+Hmwuk7dbLe6vCUyzSKgyb1ju6MuJASrfeZU26e TUccXQlGn5jk0EumgQ4O9CUxgvpr6krqQ+bgl7A/sR2oIXzZnxr1Vg== X-Received: by 2002:a05:6000:2c06:b0:43b:4312:2cbb with SMTP id ffacd0b85a97d-43b9eb10dc5mr20649690f8f.17.1774884114128; Mon, 30 Mar 2026 08:21:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Mon, 30 Mar 2026 20:51:40 +0530 X-Gm-Features: AQROBzBMG2nSkwR_VOHEbgd9k6-dmBei2n2oBV8zhwM5xbLMfTJtXHQvw8wxlsc Message-ID: Subject: Re: [PATCH] Report column-level error when lacking privilege To: Steve Chavez Cc: PostgreSQL-development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Steve, On Mon, Mar 30, 2026 at 6:37=E2=80=AFAM Steve Chavez wr= ote: > > Hello hackers, > > When a role `xx` has `grant select (name) on items to xx;`, a generic tab= le-level error is given: > > select * from items; > ERROR: permission denied for table items > > With this patch, we now give: > > select * from items; > ERROR: permission denied for column "id" of relation "items" > > This only when the user has column-level privileges, if it doesn't have a= ny the same regular table-level error is given. This makes the most sense a= nd also keeps current tests mostly the same. > > * It also works for UPDATE and INSERT. > * Clears the TODO mentioned on lines > https://github.com/postgres/postgres/blob/45cdaf3665bedfbabb908bb84284f3d= b26781ad3/src/backend/executor/execMain.c#L691-L693 > * This patch is on top of the patch mentioned on https://www.postgresql.o= rg/message-id/CAGRrpzYP%2B3zEk__KZu-a5uWySfwgRFk6eoPXKrA5AdtBTXR%3Dng%40mai= l.gmail.com, which refactors the code to make it simpler to review. I had started on this some time ago [1], but couldn't finish it for the want of time. There are some suggestions from Nathan and Tom which may be applicable to you approach as well. I am fine if you would like to use my patches if those help. [1] https://www.postgresql.org/message-id/CAExHW5swFANiB9JmqRoGg_Rkr+M=3Dqh= +ci_zfOtQXFT+A=3D+jB-A@mail.gmail.com --=20 Best Wishes, Ashutosh Bapat