Re: Can a function be parameter in PL/PGSQL function?

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Karen Hill" <karen_hill22(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Can a function be parameter in PL/PGSQL function?
Date: 2007-02-05 20:28:11
Message-ID: b42b73150702051228i25bf5d2fhb288e87aeb97c9f5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/3/07, elein <elein(at)varlena(dot)com> wrote:
> On Tue, Jan 30, 2007 at 12:32:04PM -0800, Karen Hill wrote:
> > Is it possible to have a pl/pgsql function take another pl/pgsql
> > function as one of the parameters?

I think that OP meant (correct me if I'm wrong!) to be able to do
something like:

create function bar(text) returns text as $$ select $1 || 'xyz'; $$
language sql;

create function something_complex(regprocedure) returns void as [...]
language plpgsql;

select something_complex(bar(text));

...so you pass the callback 'bar' to the complex function which
executes it over something. This isn't possible currently, but you
can fudge it with dynamic sql for simple things (no arrays, records,
or cursors), or work up something more general solution with a C
go-between.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2007-02-05 20:29:53 New RPM Sets for Fedora Core / Red Hat Enterprise Linux
Previous Message Gene 2007-02-05 20:22:45 postgresql fails to start after symlinking pgdata dir