Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 611A6634059 for ; Tue, 28 Jul 2009 21:24:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 85215-03 for ; Wed, 29 Jul 2009 00:24:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id B32CE6322D1 for ; Tue, 28 Jul 2009 21:24:28 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MVwy1-0002ch-BI for pgsql-sql@postgresql.org; Wed, 29 Jul 2009 00:24:25 +0000 Received: from e177127046.adsl.alicedsl.de ([85.177.127.46]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Jul 2009 00:24:25 +0000 Received: from tim by e177127046.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Jul 2009 00:24:25 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Tim Landscheidt Subject: Re: Tweak sql result set... ? Date: Wed, 29 Jul 2009 00:24:14 +0000 Organization: Lines: 23 Message-ID: References: <2981e447-3f11-4002-92fb-06a6af39762e@c29g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e177127046.adsl.alicedsl.de User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) Cancel-Lock: sha1:ow9BsVD4GocrQci9rWZIUY/Hga4= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.083 tagged_above=-10 required=5 tests=AWL=0.083 X-Spam-Level: X-Archive-Number: 200907/139 X-Sequence-Number: 32880 (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 "
Peter Peterson
" but I > should not have to change the original query. > I know I could write "SELECT '
' || name || '
' 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