pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: Tweak sql result set... ?
Date: Wed, 29 Jul 2009 00:24:14 +0000
Message-ID: <m3k51s72vl.fsf@passepartout.tim-landscheidt.de> (raw)
References: <2981e447-3f11-4002-92fb-06a6af39762e@c29g2000yqd.googlegroups.com>

(anonymous) 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

Have a look at CREATE RULE.

Tim




view thread (9+ messages)  latest in thread

Message-ID: <m3k51s72vl.fsf@passepartout.tim-landscheidt.de>
Permalink:  ../m3k51s72vl.fsf@passepartout.tim-landscheidt.de/
Also on:    postgresql.org/message-id/m3k51s72vl.fsf@passepartout.tim-landscheidt.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tim@tim-landscheidt.de
  Subject: Re: Tweak sql result set... ?
  In-Reply-To: <m3k51s72vl.fsf@passepartout.tim-landscheidt.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox