How to perform text merge

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to perform text merge
Date: 2010-03-28 17:43:07
Message-ID: 609BF3CE079445569FC0D047A5C816AD@andrusnotebook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Database column contains merge data in text column.
Expressions are between << and >> separators.
How to replace them with database values ?

For example, code below should return:

Hello Tom Lane!

How to implement textmerge procedure or other idea ?

Andrus.

create temp table person ( firstname text, lastname text ) on commit drop;
insert into person values ('Tom', 'Lane');
create temp table mergedata ( template text ) on commit drop;
insert into mergedata values ('Hello <<firstname||'' ''||lastname>>!');

select textmerge(template,'select * from person') from mergedata;

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrus 2010-03-28 17:43:14 Splitting text column to multiple rows
Previous Message Rick Casey 2010-03-28 17:33:09 optimizing import of large CSV file into partitioned table?