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 1vNWtq-005Wet-1Y for pgsql-general@arkaria.postgresql.org; Mon, 24 Nov 2025 13:46:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vNWtp-0012IE-0L for pgsql-general@arkaria.postgresql.org; Mon, 24 Nov 2025 13:46:37 +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 1vNWto-0012I5-2W for pgsql-general@lists.postgresql.org; Mon, 24 Nov 2025 13:46:37 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vNWtn-001El5-0L for pgsql-general@lists.postgresql.org; Mon, 24 Nov 2025 13:46:36 +0000 Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-3437ea05540so3712028a91.0 for ; Mon, 24 Nov 2025 05:46:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763991992; x=1764596792; darn=lists.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=xeG6yDjL9H7zoXY0x26z8kMp8HX4vxbPmkXD+36kptc=; b=LAZ+dVVx9OHRrDu0wQXrwMjixFzgm0klNi2QIWePbOFzGh2VdxCqtiPXOVwikrpB5N wCc1Qn8EFYgSCunCPM6vaNfM4gZNWzXRrbygCUOOgakWxCvPNxdlfc41zZr9OEAG6t5m y4d9DYaX3XhhV2Z2GkWKBnhtr/VW6upS/mEhaG21/RlxTyyggt+FPgXFHjjkfof317E6 7uegBz/3998aWoqUfRYNw7M62Lbbmp06KagaaNhlTElpdXaCvEXBvTm9HLWLt/XpagHF nuJCBikPk/e62IrRB3iFSQZ5wwToD/vi1aSaSX8YN2oklVCmGZ1pdUqEbjoMo7UDe6jJ ygug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763991992; x=1764596792; 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=xeG6yDjL9H7zoXY0x26z8kMp8HX4vxbPmkXD+36kptc=; b=s71RU6qIcDOMwjmaGgldr4QG9Cbb9yO4Nr3ZNnwcmJb5wz/FDZPi+ErPIk3QuAye7A F6/U4hg31GzCyPpC8FYPCoe/VnxIXzSIB4WgS1SfhNo2LtyyxbTeUpSZImkVguGaLH6P bEoyGR9wk3qSW7o4lYZDbYb3DJWxJUtnMDF1AZxSlfJL9dZ+gXCo46LtuvjfHSUf8B8C Bo39tzIz/VowK+S0J7ZuBPBTxK8cUODxwS5sLuT3tMCbSXuaaQ/VaEvTO/THR3i9JxNF veA9QUR3un6bhbWtkykP1b2sHFCAFvB9xyrAj4aSpARdX39hzc07tq/cgrwe7QaO67Ww s6kg== X-Gm-Message-State: AOJu0YwSTL7el42R0r2dbtuwoYu5doaB3W4B/JkgaFlOeCm7vaPVs74e oVrQyEHJZiwreZneT91Z2w4SPbSKjaXmAoEn7CsYg68l2i3NjTbGcuY5f3Bji46umYMV0xN5hjh 6lL7K0GrfzbmoG4WHLBdC7ZJQo2yOxig= X-Gm-Gg: ASbGnctGc2EfVewAmjuKpIr5yrFjYSe3mFH43/mLggcpJnyJ6Z1NQeH0q+3eoohbmP8 N8LTSWHyfIZl51ZoQ7bibmn3bkejAAIBwGhJx9PmecZUtmpsZBdIuJ2KLi8+A8FDf2LKwSaiZpG wib9KVlz1uKO1W7+kcI33vgQMWxygoFCpFXObIhgxAI7Fty2ES6ClNjwDARfHbKjIt6sQBjoeTN OtU4PRK4Fwss2L9mZgzDX0aYZWHwV89fuJaZOGQhICU3T8fVMvhQ1pE5IUrxcbT1MefjdO7bA== X-Google-Smtp-Source: AGHT+IF0sIIyxgVLBjqEjBvZRQQrauwS+laxCULNpdfWMg4MqCpKBGXbTk9fHkAP37yO6v8HG5OwTajRi08mYw+IvqM= X-Received: by 2002:a17:90b:540b:b0:343:eb40:8e01 with SMTP id 98e67ed59e1d1-34733f4ab79mr13151020a91.27.1763991991738; Mon, 24 Nov 2025 05:46:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dominique Devienne Date: Mon, 24 Nov 2025 14:46:20 +0100 X-Gm-Features: AWmQ_bk6TPTtruvdWY3IGDUYQYIRuOi5yKUBOn4c4RNXKTXroeVBcY84eICMHbU Message-ID: Subject: Re: set role command To: Calvin Guo Cc: pgsql-general@lists.postgresql.org 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 On Mon, Nov 24, 2025 at 9:15=E2=80=AFAM Calvin Guo wrote: > I really feel, once you "set role usera", you should behave like usera, y= ou should NOT have the power say: > hi, I can assume my super user power whenever I want. As this make the "s= et role usera" pretty much useless. SET ROLE is only about switching between USAGE and MEMBER of other ROLEs. Since v16, one can control individual ROLE-to-ROLE GRANTs, for INHERIT'ance= . You can be GRANT'ed a ROLE, yet the permissions (ACLs on objects) associate= d to that ROLE may not be "active", unless you INHERIT that ROLE. W/o INHERIT tr= ue, you must explicit SET ROLE to that role, to activate that role and its permissions. I thought like you initially that after a SET ROLE, that restricted which ROLE I could endorsed. But no, of course. Restricting SET ROLE on ROLEs from the subgraph makes no sense, when you can RESET ROLE to "get back up" to your "root" role (your LOGIN role, or SESSION_ROLE), and then SET ROLE to a different subgraph role. Any ROLE you are a MEMBER of, you can SET ROLE to, whatever the current_rol= e. But by playing with INHERIT'ance, you CAN control what's active/effective, for a given current role. One can always SET ROLE to some other ROLE, of course. What really matters is who CONNECT'ed / logged-IN to the DB. I.e. who is authenticated. If you start as a SUPERUSER, then you can always become SUPERUSER again, as Laurenz pointed out. Changing ROLE is only about activate this or that set = of permissions / privileges, on DB objects. Nothing more. --DD