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 1viH22-0026Ky-00 for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 19:04:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1viH21-002cEI-0M for pgsql-hackers@arkaria.postgresql.org; Tue, 20 Jan 2026 19:04:49 +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.96) (envelope-from ) id 1viH20-002cDy-28 for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 19:04:49 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1viH1y-001Zgc-0e for pgsql-hackers@lists.postgresql.org; Tue, 20 Jan 2026 19:04:48 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-658034ce0e3so1635425a12.3 for ; Tue, 20 Jan 2026 11:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garret-ru.20230601.gappssmtp.com; s=20230601; t=1768935882; x=1769540682; darn=lists.postgresql.org; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=MP/hAmjJ9yV2IvIrtK1vA/VSsr586Lyn45EVYaGko3A=; b=GDQMhDwP8kSiTOk5Y5UFMCYYXUdbsSXTDAZdtxe+BG+EKTNyTGFzoIytXgMuZDLWtl trRLjmgCJ2UqxDJdThffvw4iSS7axxeAvFjbXN6zq6ipi2H561Zp/2BAaSU7N9k+v+NA 21ys0m9qWM2sqUJCz4w+PVsaBWLeLhBr7lN0Zh/lm3+a0fOI6A5HcwsN56e9ueOHjZ8O IYQ0h+1D0ZAGoyejSAACuYp2zFnNlZI+uBvRB44AHjOhbXK9KNzWECaXdm2iZXNo9HK0 c6eOKJ4I9phN2AxuL83pDlnwt//x/q8zFwB+Tp17pFVu4xFdPselzeAScljJPRRrdgp0 KeHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768935882; x=1769540682; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MP/hAmjJ9yV2IvIrtK1vA/VSsr586Lyn45EVYaGko3A=; b=wER0kN4asru9iTGtqTm9JqH5i/YGN7M7Zp5jHGFIdNiE82wVD0x73O6A0yS1ua636p N2PCdqS7YVKEx7ZUceaVC8qjlRx6EpVB7CYinLQGDBUwbE/IsMh+brb970IjCAW9lsGk yAs8xKhQ95nVxFT45+wfhd/vAP0j3leM17M4JBUr8N4MBzfs4ochs/cknpTS/vnYWXSS FD1xPdYNrrKo7qqWmAUOO3RIMFMryi9ucpkKlr8HK9XQ9JugOlmWWTCBo3C7xmBuu0MS gXCc4KEe2wMETtuZ6ZvngPt9mVS8t8MVygVu1tU56/afF3/LkKm/zBDHi7e+iyX5K3pp UUYQ== X-Gm-Message-State: AOJu0YxCVQ00pVPgww48gXeusnELyyklmCUjg5rKybsDEsNkZtiE8olB FFwrADJwkYiIh1kZpPU+hVJCpepUSI/DTdsomBIRPjxk6CrbPdaqPu91wy6GzkVeeYrehK1FmQB 06iAeyg== X-Gm-Gg: AZuq6aJRPg5h8WxO5KEoxW+zUlGT8CZICRDyK36fpoqQ5zkZS3RsIa1OIoDA2aM8t9H Zon6Ht63WYY+cWwKGFvykgcUroO2tQJcu9QhzLII8STyWAdHGig88daDMFRn9rcauPogSYyu/hk VMsKOslRRfBJQops5zmucAMK1wnJQfmN1FubirMn1HrZX7blEDO6LOsMMhT6tX2NVxw0YJWYEsK L+yabkP0rUqdVAyuyXg/YFSAqwRTQAuXt301nTJ+3tlWsuUKGGHyTrcmhuvmNhXnV/Jpr6V5Ri/ uTCCWjjSZ1K9rupcgMW4ApViRSlFxQnoGxLbfJicTuDH2E6Nr/Vn36geOtmAH+q1mKnlFD8wnjR wvJlE2k0OosB9aL0CSDwdyM5spveXUX/2iD2A/QiK9uaAMS2Elzp5afOvxvHu5Boj2lWu7Cgo7i Cm5DeDGWiyRuRN4uSPSbU6 X-Received: by 2002:a05:6402:2688:b0:650:8563:fdee with SMTP id 4fb4d7f45d1cf-657ff4cba57mr2189208a12.25.1768935882026; Tue, 20 Jan 2026 11:04:42 -0800 (PST) Received: from [10.248.37.148] ([130.41.208.2]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65452cdb0e4sm13832671a12.13.2026.01.20.11.04.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Jan 2026 11:04:40 -0800 (PST) Message-ID: <85cd06c6-7b2e-483e-b05d-d5ff87b0168d@garret.ru> Date: Tue, 20 Jan 2026 21:04:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: PostgreSQL Hackers From: Konstantin Knizhnik Subject: Mystery with REVOKE PRIVILEGE Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi hackers! I found some very confusing behaviour of REVOKE PRIVILEGE. I wonder whether it is bug or feature: create role reader; create role somebody; grant reader to somebody; grant to somebody; create table t(x integer); grant select on table t to somebody with grant option; begin; set local role somebody; grant select on table t to reader; commit; SELECT * FROM information_schema.role_table_grants AS rtg WHERE grantee='reader'; begin; set local role somebody; revoke all privileges on table t from reader granted by somebody; commit; SELECT * FROM information_schema.role_table_grants AS rtg WHERE grantee='reader'; where is any role with admin permissions under which you logged in. The strange thing is output of last command: postgres=# SELECT * FROM information_schema.role_table_grants AS rtg WHERE grantee='reader';  grantor  | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy ----------+---------+---------------+--------------+------------+----------------+--------------+----------------  somebody | reader  | postgres      | public       | t          | SELECT         | NO           | YES (1 row) So  granted read privilege was not revoked. But if instead of REVOKE ALL PRIVILEGES` I do `REVOKE SELECT`, then everything is ok: postgres=#  begin; BEGIN postgres=*# set local role somebody; SET postgres=*> revoke select on table t from reader granted by somebody; REVOKE postgres=*> commit; COMMIT postgres=# SELECT * FROM information_schema.role_table_grants AS rtg WHERE grantee='reader';  grantor | grantee | table_catalog | table_schema | table_name | privilege_type | is_grantable | with_hierarchy ---------+---------+---------------+--------------+------------+----------------+--------------+---------------- (0 rows) The critical thing is this grant statement: grant to somebody; If it is skipped, then the problem is not reproduced.