Skip site navigation (1) Skip section navigation (2)

Re: How to perform text merge

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Alban Hertroys" <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to perform text merge
Date: 2010-03-28 20:48:20
Message-ID: F560621B70F448FBAC5A3B30E1F26A5C@andrusnotebook (view raw or flat)
Thread:
Lists: pgsql-general
> Since you pretty much invented your own language

Expressions are in PostgreSql syntax.

I expected that there is some way to force PostgreSql to evaluate them at
runtime using something like pgsql EXECUTE
For example,

'Hello <<firstname||'' ''||lastname>>!'

should be converted (inverted) to

'Hello ' || firstname||' '||lastname || '!'

and  then pgsql EXECUTE can be used to perform text merge just like .asp
pages are pre-processed and compiled.

How to do this is PostgreSql or in C# in MONO/.NET ?

> Personally I think you're using a bad example here, as usually names don't
> just involve firstname and surname, but frequently have infixes, suffixes
> and titles and such. Not all of those fields are going to have values for
> every person in your database. What happens if you don't have a Tom Lane,
> but a mr. Lane, or if you have both but want to address a person more
> politely?

COALESCE(), CASE WHEN  and other pgsql constructs can be used to create
correct address expressions from any data.

Andrus.


In response to

pgsql-general by date

Next:From: AndrusDate: 2010-03-28 20:48:28
Subject: Re: Splitting text column to multiple rows
Previous:From: Faheem MithaDate: 2010-03-28 20:05:31
Subject: Re: simultaneously reducing both memory usage and runtime for a query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group