Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTAG7-0001Sj-HK for pgsql-sql@postgresql.org; Tue, 30 Oct 2012 11:45:27 +0000 Received: from mout.web.de ([212.227.17.11]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTAG0-0005ip-BX for pgsql-sql@postgresql.org; Tue, 30 Oct 2012 11:45:26 +0000 Received: from [10.0.1.2] ([213.61.228.214]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LfzgJ-1T3waz3rnX-00pT9g for ; Tue, 30 Oct 2012 12:45:19 +0100 From: jan zimmek Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: replace text occurrences loaded from table Message-Id: <47098D72-27B8-4634-8010-066B4765FE91@web.de> Date: Tue, 30 Oct 2012 12:45:19 +0100 To: pgsql-sql@postgresql.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) X-Mailer: Apple Mail (2.1499) X-Provags-ID: V02:K0:FwG9nHscfdhVPiK/gtn3OXyJckliLGDk9QzHs0x/LIa DuZKWI2QpF7saT+lAl8/1qsIxAs/yXKfrLVa/2Ys6/INrV/fxd uizkOl7LagJ9HJ1jgdmLIdvRGRi0BJT2Ix88DZJSkNlIT8jE1R xVwNA9SucgG8f6XbLt90oXDgEAgUAAtZn0LkFfoEzwFv7orW8q iC7V+DgY6MKv8JzCtEuyw== X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201210/60 X-Sequence-Number: 36931 hello, i am actually trying to replace all occurences in a text column with = some value, but the occurrences to replace are defined in a table. this = is a simplified version of my schema: create temporary table tmp_vars as select var from = (values('ABC'),('XYZ'),('VAR123')) entries (var); create temporary table tmp_messages as select message from (values('my = ABC is XYZ'),('the XYZ is very VAR123')) messages (message); select * from tmp_messages; my ABC is XYZ -- row 1 the XYZ is very VAR123 -- row 2 now i need to somehow update the rows in tmp_messages, so that after the = update i get the following: select * from tmp_messages; my XXX is XXX -- row 1 the XXX is very XXX -- row 2 i have implemented a solution in plpgsql by doing a nested for-loop over = tmp_vars and tmp_messages, but i would like to know if there is a more = efficient way to solve this problem ? best regards jan=