Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 39C56B5DC02 for ; Sat, 17 Sep 2011 15:34:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 44325-07 for ; Sat, 17 Sep 2011 18:34:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 56742B5DBC8 for ; Sat, 17 Sep 2011 15:34:43 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1R4zit-00065q-3T for pgsql-sql@postgresql.org; Sat, 17 Sep 2011 20:34:43 +0200 Received: from g231144003.adsl.alicedsl.de ([92.231.144.3]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Sep 2011 20:34:43 +0200 Received: from tim by g231144003.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 17 Sep 2011 20:34:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: pgsql-sql@postgresql.org To: pgsql-sql@postgresql.org From: Tim Landscheidt Subject: Re: Passing function parameters to regexp_replace Date: Sat, 17 Sep 2011 18:34:29 +0000 Organization: Lines: 25 Message-ID: References: <201109171321.43309.leif@solumslekt.org> <201109171331.58663.leif@solumslekt.org> <201109171927.56033.leif@solumslekt.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: g231144003.adsl.alicedsl.de Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:J54RJXuXmvy/P33ZFNfjEMsHU/s= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/48 X-Sequence-Number: 35848 Leif Biberg Kristensen wrote: > On Saturday 17. September 2011 19.07.03 Tim Landscheidt wrote: >> Leif Biberg Kristensen wrote: >> > UPDATE sources SET source_text = regexp_replace(source_text, >> > E'n="(.*?)$1(.*?)"', E'n="\\1$2\\2"', 'g') where source_text like >> > '%n="%$1%">%' >> Try: >> > UPDATE sources SET source_text = regexp_replace(source_text, >> > CONCAT(E'n="(.*?)', $1, E'(.*?)"'), CONCAT(E'n="\\1', $2, '\\2"', 'g') >> > where source_text like CONCAT('%n="%', $1, '%">%') > The function CONCAT doesn't exist i PostgreSQL. Eh, yes, of course. > And I can't get it to work > with EXECUTE and standard concatenation either: > [...] What do you need the EXECUTE for? Just drop it. Tim