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 1lH6wK-0002gw-PQ for pgsql-general@arkaria.postgresql.org; Tue, 02 Mar 2021 15:28:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lH6wJ-0006qK-Mj for pgsql-general@arkaria.postgresql.org; Tue, 02 Mar 2021 15:27:59 +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 1lH6wJ-0006qC-Em for pgsql-general@lists.postgresql.org; Tue, 02 Mar 2021 15:27:59 +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 1lH6wH-0001Yh-BB for pgsql-general@postgresql.org; Tue, 02 Mar 2021 15:27:59 +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 122FRtZM938716; Tue, 2 Mar 2021 10:27:55 -0500 From: Tom Lane To: Alexander Farber cc: pgsql-general Subject: Re: Localizing stored functions by replacing placeholders in their body In-reply-to: References: Comments: In-reply-to Alexander Farber message dated "Tue, 02 Mar 2021 15:34:58 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <938714.1614698875.1@sss.pgh.pa.us> Date: Tue, 02 Mar 2021 10:27:55 -0500 Message-ID: <938715.1614698875@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alexander Farber writes: > update pg_proc set prosrc = regexp_replace(prosrc, '$\(\w+\)','Hi > english','g') where proname='localize_hello'; "$" is a metacharacter in regexes ... writing \$ might help. (The idea of direct updates on the system catalogs seems like a really bad one. Why not pass the code through sed or the like ahead of feeding it to psql? But you'd have to get the regex syntax right in any case.) regards, tom lane