Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBhd6-0000AD-7H for pgsql-general@arkaria.postgresql.org; Mon, 15 Feb 2021 17:25:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lBhd5-0002N8-6g for pgsql-general@arkaria.postgresql.org; Mon, 15 Feb 2021 17:25:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBhd4-0002N1-Vf for pgsql-general@lists.postgresql.org; Mon, 15 Feb 2021 17:25:46 +0000 Received: from dd27502.kasserver.com ([85.13.146.49]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lBhd2-0007kj-Cz for pgsql-general@lists.postgresql.org; Mon, 15 Feb 2021 17:25:45 +0000 Received: from [192.168.0.24] (ip-37-201-154-176.hsi13.unitymediagroup.de [37.201.154.176]) by dd27502.kasserver.com (Postfix) with ESMTPSA id 08F2860C0465 for ; Mon, 15 Feb 2021 18:25:40 +0100 (CET) To: pgsql-general@lists.postgresql.org From: Wolfgang Walther Subject: ALTER ROLE ... SET in current database only Message-ID: <2b2fc152-63cb-1d4a-93c2-f57f28a98fce@technowledgy.de> Date: Mon, 15 Feb 2021 18:25:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I'm trying to set a GUC for a role in the current database only - but don't know the name of the database at the time of writing code. Could be development, staging, ... I would basically like to do something like this: ALTER ROLE a IN CURRENT DATABASE SET b TO c; Although that syntax doesn't exist (yet). I think I could wrap it in a DO block and create the statement dynamically. Alternatively, I could probably INSERT INTO / UPDATE pg_db_role_setting manually? Any other ideas how to achieve this easily? Does the proposed "IN CURRENT DATABASE" syntax sound useful to anyone else? Best, Wolfgang