Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B15FC63279B for ; Tue, 27 Apr 2010 10:10:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 47066-09 for ; Tue, 27 Apr 2010 13:10:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail47.e.nsc.no (mail47.e.nsc.no [193.213.115.47]) by mail.postgresql.org (Postfix) with ESMTP id 45D196321C5 for ; Tue, 27 Apr 2010 10:10:30 -0300 (ADT) Received: from balapapa.localnet (42.185.16.62.customer.cdi.no [62.16.185.42]) (authenticated bits=0) by mail47.nsc.no (8.14.3/8.14.3) with ESMTP id o3RDARpB008319 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 27 Apr 2010 15:10:27 +0200 (MEST) From: Leif Biberg Kristensen To: pgsql-sql@postgresql.org Subject: Re: regexp_replace and search/replace values stored in table Date: Tue, 27 Apr 2010 15:10:26 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.32-gentoo-r7; KDE/4.3.5; i686; ; ) References: <201004271343.48070.leif@solumslekt.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004271510.26539.leif@solumslekt.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_40=-0.001 X-Spam-Level: X-Archive-Number: 201004/98 X-Sequence-Number: 34025 On Tuesday 27. April 2010 15.04.23 Tim Landscheidt wrote: > Leif Biberg Kristensen wrote: > > > [...] > > So far, so good. But when I try to do the actual expansion, I'm stumped. > > > pgslekt=> select regexp_replace((select source_text from sources where > > source_id=23091), (select quote_literal(short_link) from short_links where > > link_type = 'sk'), (select quote_literal(long_link) from short_links where > > link_type = 'sk'), 'g'); > > regexp_replace > > ------------------------------------------------------------------------------------------------ > > [sk=25658|67|side 66a]. Vabakken under Klyve vestre i Solum 07.07.1784: > > [p=6947|Isach Jonsen]. > > (1 row) > > > What am I missing? > > For starters, omit the call to quote_literal (). > > Tim Tim, that was actually the first thing i tried, but I omitted it from the post: pgslekt=> select regexp_replace((select source_text from sources where source_id=23091), (select short_link from short_links where link_type = 'sk'), (select long_link from short_links where link_type = 'sk'), 'g'); regexp_replace ------------------------------------------------------------------------------------------------ [sk=25658|67|side 66a]. Vabakken under Klyve vestre i Solum 07.07.1784: [p=6947|Isach Jonsen]. (1 row) It doesn't work either. regards, -- Leif Biberg Kristensen http://solumslekt.org/