Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 471AB6352E7 for ; Wed, 29 Jul 2009 09:41:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 51610-01-4 for ; Wed, 29 Jul 2009 12:40:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from titania.wxnz.net (titania.wxnz.net [58.28.4.13]) by mail.postgresql.org (Postfix) with ESMTP id CA99B6354EC for ; Wed, 29 Jul 2009 09:39:57 -0300 (ADT) Received: from gonzo (ip-118-90-137-18.xdsl.xnet.co.nz [118.90.137.18]) by titania.wxnz.net (Postfix) with ESMTP id CC17D109817A for ; Thu, 30 Jul 2009 00:39:53 +1200 (NZST) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1MW8Rk-00007z-UA for pgsql-sql@postgresql.org; Thu, 30 Jul 2009 00:39:52 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: Tweak sql result set... ? Date: 29 Jul 2009 12:39:52 GMT Organization: Dis (not Dat) Organisation Lines: 22 Message-ID: References: <2981e447-3f11-4002-92fb-06a6af39762e@c29g2000yqd.googlegroups.com> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1248871192 32513 127.0.0.1 (29 Jul 2009 12:39:52 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/143 X-Sequence-Number: 32884 On 2009-07-28, Axe 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 put a wrapper round whatever it is you use to send the queries that modifies the returned values.