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 1jqJuS-0004ew-0S for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Jun 2020 17:19:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jqJuQ-0007h5-Kq for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Jun 2020 17:19:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jqJuQ-0007gy-El for pgsql-bugs@lists.postgresql.org; Tue, 30 Jun 2020 17:19:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jqJuO-0002ll-CS for pgsql-bugs@lists.postgresql.org; Tue, 30 Jun 2020 17:19:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05UHIvGA491241; Tue, 30 Jun 2020 13:18:57 -0400 From: Tom Lane To: "David G. Johnston" cc: "mbwiese@gmail.com" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #16519: SET SESSION ROLE in plpgsql requires string literal. In-reply-to: References: <16519-9ef04828d058a319@postgresql.org> Comments: In-reply-to "David G. Johnston" message dated "Tue, 30 Jun 2020 09:39:03 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <491239.1593537537.1@sss.pgh.pa.us> Date: Tue, 30 Jun 2020 13:18:57 -0400 Message-ID: <491240.1593537537@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > The SET command cannot be parameterized so using variables in the statement > is not supported and the attempt to do so is treated as writing an > identifier. You will need to use the format function and the execute > plpgsql command to create and execute the statement. While this is documented (last para of "42.11.1. Variable Substitution"), it's not exactly prominent. Should we move that to somewhere more visible? If so where? regards, tom lane