Re: Tweak sql result set... ?

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Tweak sql result set... ?
Date: 2009-07-29 12:39:52
Message-ID: h4pfuo$vo1$2@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2009-07-28, Axe <info(at)axier(dot)se> wrote:
> I have a problem where I want to tweak a simple select in an
> "unobtrusive way". Imagine I have the following select statement:
> "SELECT name FROM customer LIMIT 1" and I get a normal result set from
> this. But, could I,maybe by defining some other function or similar,
> change the result set *without* changing the query? Suppose I get the
> result from the query above, saying: "Peter Peterson". I would
> (sometimes) like to get the result "<div>Peter Peterson</div>" but I
> should not have to change the original query.
>
> I know I could write "SELECT '<div>' || name || '</div>' as name FROM
> customer" but then I have altered the original query and I cannot do
> this since it is supposed to function different in two different
> situations.
>
> Any ideas on how to achieve this? I would like to let the original sql
> code stay original. I can prepare postgres before executing the sql if
> this makes it easier to acheive the goal

put a wrapper round whatever it is you use to send the queries that
modifies the returned values.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Daryl Richter 2009-07-29 13:44:37 Re: sql-porting-problem oracle to postgresql with UPDATE/IS NOT NULL
Previous Message nha 2009-07-29 11:03:59 Re: WG: sql-porting-problem oracle to postgresql with UPDATE/IS NOT NULL