Re: Localizing stored functions by replacing placeholders in their body

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Localizing stored functions by replacing placeholders in their body
Date: 2021-03-02 15:27:55
Message-ID: 938715.1614698875@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alexander Farber <alexander(dot)farber(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2021-03-02 15:57:43 Re: Localizing stored functions by replacing placeholders in their body
Previous Message Alexander Farber 2021-03-02 14:34:58 Localizing stored functions by replacing placeholders in their body