Re: How to perform text merge - Mailing list pgsql-general

From Andrus
Subject Re: How to perform text merge
Date
Msg-id F560621B70F448FBAC5A3B30E1F26A5C@andrusnotebook
Whole thread Raw
In response to Re: How to perform text merge  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List 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.


pgsql-general by date:

Previous
From: Faheem Mitha
Date:
Subject: Re: simultaneously reducing both memory usage and runtime for a query
Next
From: "Andrus"
Date:
Subject: Re: Splitting text column to multiple rows