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 40872D1C4C1 for ; Tue, 22 Jul 2003 23:37:44 +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 01491-09 for ; Tue, 22 Jul 2003 20:37:00 -0300 (ADT) Received: from varlena.com (adsl-63-207-12-205.dsl.snfc21.pacbell.net [63.207.12.205]) by svr1.postgresql.org (Postfix) with ESMTP id 0CBF8D1C4DF for ; Tue, 22 Jul 2003 20:37:42 -0300 (ADT) Received: by varlena.com (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 23112394BA; Tue, 22 Jul 2003 16:33:35 -0700 (PDT) Date: Tue, 22 Jul 2003 16:33:35 -0700 From: elein To: Robert Treat Cc: pgsql-sql@postgresql.org Subject: Re: obtuse plpgsql function needs Message-ID: <20030722163335.A18881@cookie> References: <1058913112.22259.271.camel@camel> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1058913112.22259.271.camel@camel> User-Agent: Mutt/1.3.22.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/331 X-Sequence-Number: 14445 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. 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; > > > I'm starting to believe this is not possible, has anyone already done > it? :-) > > Robert Treat > -- > Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend >