X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id CB7FBD1C7EF for ; Wed, 23 Jul 2003 13:06:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 26127-02 for ; Wed, 23 Jul 2003 10:06:10 -0300 (ADT) Received: from localhost.localdomain (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id D3D9AD1C7EB for ; Wed, 23 Jul 2003 10:06:46 -0300 (ADT) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.8/8.12.8) with ESMTP id h6NBipqd020503; Wed, 23 Jul 2003 07:44:51 -0400 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h6ND6nZ28114; Wed, 23 Jul 2003 09:06:50 -0400 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id 34ADMFM4; Wed, 23 Jul 2003 09:06:48 -0400 Subject: Re: obtuse plpgsql function needs From: Robert Treat To: elein Cc: pgsql-sql@postgresql.org In-Reply-To: <20030722163335.A18881@cookie> References: <1058913112.22259.271.camel@camel> <20030722163335.A18881@cookie> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 23 Jul 2003 09:06:49 -0400 Message-Id: <1058965609.22259.292.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/337 X-Sequence-Number: 14451 On Tue, 2003-07-22 at 19:33, elein wrote: > You'll need to pass the values down to your > concat function (which I suggest you don't call concat) > and have it return a text type. > > What exactly is your problem? I must be missing something. > The problem is that I need the function to be generic so that I don't have to pass the values down to the function, it just grabs the values automagically based on the table it's being called against. Robert Treat > elein > > On Tue, Jul 22, 2003 at 06:31:52PM -0400, Robert Treat wrote: > > given > > > > create table t1 (f,f1,f2,f3); > > create table t2 (f,f4,f5,f6); > > > > i'm trying to create a function concat() that does something like: > > > > select f,concat() as info from t1; > > > > which returns a result set equivalent to: > > select f,('f1:' || f1 || '- f2:' || f2 || '- f3:' || f3) as x from t1; > > > > or > > select f,concat() as info from t2; > > returns equivalent > > > > select f,('f4:' || f4 || ' - f5:' || f5 || ' - f6:' || f6) as x from t2; > > -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL