From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Farber <alexander.farber@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Localizing stored functions by replacing placeholders in their body
Date: Tue, 02 Mar 2021 10:27:55 -0500
Message-ID: <938715.1614698875@sss.pgh.pa.us> (raw)
In-Reply-To: <CAADeyWiVL-N0XPipT--ypL5BzCnpSe6+c8RdHaKnx6u6PoHqJA@mail.gmail.com>
References: <CAADeyWiVL-N0XPipT--ypL5BzCnpSe6+c8RdHaKnx6u6PoHqJA@mail.gmail.com>
Alexander Farber <alexander.farber@gmail.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, alexander.farber@gmail.com
Subject: Re: Localizing stored functions by replacing placeholders in their body
In-Reply-To: <938715.1614698875@sss.pgh.pa.us>
References: <CAADeyWiVL-N0XPipT--ypL5BzCnpSe6+c8RdHaKnx6u6PoHqJA@mail.gmail.com> <938715.1614698875@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox