Re: obtuse plpgsql function needs

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: elein <elein(at)varlena(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: obtuse plpgsql function needs
Date: 2003-07-23 13:06:49
Message-ID: 1058965609.22259.292.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Treat 2003-07-23 14:04:13 Re: obtuse plpgsql function needs
Previous Message oheinz 2003-07-23 12:51:48 Problem using Subselect results